34#include "llvm/IR/IntrinsicsX86.h"
49#define DEBUG_TYPE "x86-lower-amx-intrinsics"
54 return FVT->getNumElements() == 256 &&
55 FVT->getElementType()->isIntegerTy(32);
61class X86LowerAMXIntrinsics {
65 X86LowerAMXIntrinsics(
Function &
F, DomTreeUpdater &DomTU, LoopInfo *LoopI)
66 : Func(
F), DTU(DomTU), LI(LoopI) {}
72 BasicBlock *createLoop(BasicBlock *Preheader, BasicBlock *Exit,
Value *Bound,
73 ConstantInt *Step, StringRef Name, IRBuilderBase &
B,
75 template <
bool IsTileLoad>
76 Value *createTileLoadStoreLoops(BasicBlock *Start, BasicBlock *
End,
79 template <Intrinsic::ID IntrID>
80 std::enable_if_t<IntrID == Intrinsic::x86_tdpbssd_internal ||
81 IntrID == Intrinsic::x86_tdpbsud_internal ||
82 IntrID == Intrinsic::x86_tdpbusd_internal ||
83 IntrID == Intrinsic::x86_tdpbuud_internal ||
84 IntrID == Intrinsic::x86_tdpbf16ps_internal,
86 createTileDPLoops(BasicBlock *Start, BasicBlock *
End, IRBuilderBase &
B,
89 template <
bool IsTileLoad>
90 bool lowerTileLoadStore(Instruction *TileLoadStore);
91 template <Intrinsic::ID IntrID>
92 std::enable_if_t<IntrID == Intrinsic::x86_tdpbssd_internal ||
93 IntrID == Intrinsic::x86_tdpbsud_internal ||
94 IntrID == Intrinsic::x86_tdpbusd_internal ||
95 IntrID == Intrinsic::x86_tdpbuud_internal ||
96 IntrID == Intrinsic::x86_tdpbf16ps_internal,
98 lowerTileDP(Instruction *TileDP);
99 bool lowerTileZero(Instruction *TileZero);
115 Type *I16Ty = Type::getInt16Ty(Ctx);
119 PHINode::Create(I16Ty, 2, Name +
".iv", Header->getTerminator()->getIterator());
120 IV->addIncoming(ConstantInt::get(I16Ty, 0), Preheader);
122 B.SetInsertPoint(Latch);
123 Value *Inc =
B.CreateAdd(
IV, Step, Name +
".step");
124 Value *
Cond =
B.CreateICmpNE(Inc, Bound, Name +
".cond");
128 "Expected a non-zero step size. This is chosen by the pass and "
129 "should always be non-zero to imply a finite loop.");
132 *BR, {BoundInt->getZExtValue() / Step->
getZExtValue(), 1},
false);
136 IV->addIncoming(Inc, Latch);
142 {DominatorTree::Delete, Preheader, Tmp},
143 {DominatorTree::Insert, Header, Body},
144 {DominatorTree::Insert, Body, Latch},
145 {DominatorTree::Insert, Latch, Header},
146 {DominatorTree::Insert, Latch,
Exit},
147 {DominatorTree::Insert, Preheader, Header},
150 L->addBasicBlockToLoop(Header, *LI);
151 L->addBasicBlockToLoop(Body, *LI);
152 L->addBasicBlockToLoop(Latch, *LI);
157template <
bool IsTileLoad>
158Value *X86LowerAMXIntrinsics::createTileLoadStoreLoops(
159 BasicBlock *Start, BasicBlock *
End, IRBuilderBase &
B,
Value *Row,
161 std::string IntrinName = IsTileLoad ?
"tileload" :
"tilestore";
162 Loop *RowLoop =
nullptr;
163 Loop *ColLoop =
nullptr;
169 ParentL->addChildLoop(RowLoop);
175 IntrinName +
".scalarize.rows",
B, RowLoop);
178 BasicBlock *ColBody = createLoop(RowBody, RowLatch, Col,
B.getInt16(1),
179 IntrinName +
".scalarize.cols",
B, ColLoop);
186 Type *EltTy =
B.getInt32Ty();
193 Value *CurrentRowZExt =
B.CreateZExt(CurrentRow, Stride->
getType());
194 Value *CurrentColZExt =
B.CreateZExt(CurrentCol, Stride->
getType());
196 B.CreateAdd(
B.CreateMul(CurrentRowZExt, Stride), CurrentColZExt);
198 Value *
Idx =
B.CreateAdd(
B.CreateMul(CurrentRow,
B.getInt16(16)), CurrentCol);
205 PHINode *VecCPhiRowLoop =
B.CreatePHI(V256I32Ty, 2,
"vec.phi.row");
212 PHINode *VecPhi =
B.CreatePHI(V256I32Ty, 2,
"vec.phi");
221 Value *Elt =
B.CreateLoad(EltTy, EltPtr);
222 Value *ResVec =
B.CreateInsertElement(VecPhi, Elt, Idx);
229 Value *Vec = BitCast->getOperand(0);
237 Value *Elt =
B.CreateExtractElement(Vec, Idx);
239 B.CreateStore(Elt, EltPtr);
244template <Intrinsic::ID IntrID>
245std::enable_if_t<IntrID == Intrinsic::x86_tdpbssd_internal ||
246 IntrID == Intrinsic::x86_tdpbsud_internal ||
247 IntrID == Intrinsic::x86_tdpbusd_internal ||
248 IntrID == Intrinsic::x86_tdpbuud_internal ||
249 IntrID == Intrinsic::x86_tdpbf16ps_internal,
251X86LowerAMXIntrinsics::createTileDPLoops(BasicBlock *Start, BasicBlock *
End,
252 IRBuilderBase &
B,
Value *Row,
255 std::string IntrinName;
257 case Intrinsic::x86_tdpbssd_internal:
258 IntrinName =
"tiledpbssd";
260 case Intrinsic::x86_tdpbsud_internal:
261 IntrinName =
"tiledpbsud";
263 case Intrinsic::x86_tdpbusd_internal:
264 IntrinName =
"tiledpbusd";
266 case Intrinsic::x86_tdpbuud_internal:
267 IntrinName =
"tiledpbuud";
269 case Intrinsic::x86_tdpbf16ps_internal:
270 IntrinName =
"tiledpbf16ps";
273 Loop *RowLoop =
nullptr;
274 Loop *ColLoop =
nullptr;
275 Loop *InnerLoop =
nullptr;
283 ParentL->addChildLoop(RowLoop);
289 IntrinName +
".scalarize.rows",
B, RowLoop);
292 BasicBlock *ColBody = createLoop(RowBody, RowLatch, Col,
B.getInt16(1),
293 IntrinName +
".scalarize.cols",
B, ColLoop);
299 createLoop(ColBody, ColLoopLatch, K,
B.getInt16(1),
300 IntrinName +
".scalarize.inner",
B, InnerLoop);
308 Value *CurrentInner = &*InnerLoopHeader->
begin();
312 Value *VecC = BitCastAcc->getOperand(0);
318 Value *VecA = BitCastLHS->getOperand(0);
321 Value *VecB = BitCastRHS->getOperand(0);
331 PHINode *VecCPhiRowLoop =
B.CreatePHI(V256I32Ty, 2,
"vec.c.phi.row");
334 PHINode *VecDPhiRowLoop =
B.CreatePHI(V256I32Ty, 2,
"vec.d.phi.row");
348 PHINode *VecCPhiColLoop =
B.CreatePHI(V256I32Ty, 2,
"vec.c.phi.col");
349 VecCPhiColLoop->
addIncoming(VecCPhiRowLoop, RowBody);
350 PHINode *VecDPhiColLoop =
B.CreatePHI(V256I32Ty, 2,
"vec.d.phi.col");
351 VecDPhiColLoop->
addIncoming(VecDPhiRowLoop, RowBody);
353 B.CreateAdd(
B.CreateMul(CurrentRow,
B.getInt16(16)), CurrentCol);
361 PHINode *VecCPhi =
B.CreatePHI(V256I32Ty, 2,
"vec.c.inner.phi");
366 B.CreateAdd(
B.CreateMul(CurrentRow,
B.getInt16(16)), CurrentInner);
368 B.CreateAdd(
B.CreateMul(CurrentInner,
B.getInt16(16)), CurrentCol);
369 Value *NewVecC =
nullptr;
371 if (IntrID != Intrinsic::x86_tdpbf16ps_internal) {
388 Value *EltC =
B.CreateExtractElement(VecCPhi, IdxC);
389 Value *EltA =
B.CreateExtractElement(VecA, IdxA);
390 Value *SubVecA =
B.CreateBitCast(EltA, V4I8Ty);
391 Value *EltB =
B.CreateExtractElement(VecB, IdxB);
392 Value *SubVecB =
B.CreateBitCast(EltB, V4I8Ty);
393 Value *SEXTSubVecB =
nullptr;
394 Value *SEXTSubVecA =
nullptr;
396 case Intrinsic::x86_tdpbssd_internal:
397 SEXTSubVecB =
B.CreateSExt(SubVecB, V4I32Ty);
398 SEXTSubVecA =
B.CreateSExt(SubVecA, V4I32Ty);
400 case Intrinsic::x86_tdpbsud_internal:
401 SEXTSubVecB =
B.CreateZExt(SubVecB, V4I32Ty);
402 SEXTSubVecA =
B.CreateSExt(SubVecA, V4I32Ty);
404 case Intrinsic::x86_tdpbusd_internal:
405 SEXTSubVecB =
B.CreateSExt(SubVecB, V4I32Ty);
406 SEXTSubVecA =
B.CreateZExt(SubVecA, V4I32Ty);
408 case Intrinsic::x86_tdpbuud_internal:
409 SEXTSubVecB =
B.CreateZExt(SubVecB, V4I32Ty);
410 SEXTSubVecA =
B.CreateZExt(SubVecA, V4I32Ty);
415 Value *SubVecR =
B.CreateAddReduce(
B.CreateMul(SEXTSubVecA, SEXTSubVecB));
416 Value *ResElt =
B.CreateAdd(EltC, SubVecR);
417 NewVecC =
B.CreateInsertElement(VecCPhi, ResElt, IdxC);
443 Value *EltC =
B.CreateExtractElement(VecCPhi, IdxC);
444 Value *EltCF32 =
B.CreateBitCast(EltC,
B.getFloatTy());
445 Value *EltA =
B.CreateExtractElement(VecA, IdxA);
446 Value *SubVecA =
B.CreateBitCast(EltA, V2I16Ty);
447 Value *EltB =
B.CreateExtractElement(VecB, IdxB);
448 Value *SubVecB =
B.CreateBitCast(EltB, V2I16Ty);
450 int ShuffleMask[4] = {2, 0, 3, 1};
451 auto ShuffleArray =
ArrayRef(ShuffleMask);
452 Value *AV2F32 =
B.CreateBitCast(
453 B.CreateShuffleVector(SubVecA, ZeroV2I16, ShuffleArray), V2F32Ty);
454 Value *BV2F32 =
B.CreateBitCast(
455 B.CreateShuffleVector(SubVecB, ZeroV2I16, ShuffleArray), V2F32Ty);
456 Value *SubVecR =
B.CreateFAddReduce(EltCF32,
B.CreateFMul(AV2F32, BV2F32));
457 Value *ResElt =
B.CreateBitCast(SubVecR,
B.getInt32Ty());
458 NewVecC =
B.CreateInsertElement(VecCPhi, ResElt, IdxC);
466 Value *NewEltC =
B.CreateExtractElement(NewVecC, IdxC);
467 Value *NewVecD =
B.CreateInsertElement(VecDPhiColLoop, NewEltC, IdxC);
471 VecCPhiColLoop->
addIncoming(NewVecC, ColLoopLatch);
473 VecDPhiColLoop->
addIncoming(NewVecD, ColLoopLatch);
478template <Intrinsic::ID IntrID>
479std::enable_if_t<IntrID == Intrinsic::x86_tdpbssd_internal ||
480 IntrID == Intrinsic::x86_tdpbsud_internal ||
481 IntrID == Intrinsic::x86_tdpbusd_internal ||
482 IntrID == Intrinsic::x86_tdpbuud_internal ||
483 IntrID == Intrinsic::x86_tdpbf16ps_internal,
485X86LowerAMXIntrinsics::lowerTileDP(Instruction *TileDP) {
491 PreBuilder.SetInsertPoint(TileDP);
495 Value *NDWord = PreBuilder.CreateLShr(
N, PreBuilder.getInt16(2));
496 Value *KDWord = PreBuilder.CreateLShr(K, PreBuilder.getInt16(2));
501 Value *ResVec = createTileDPLoops<IntrID>(Start,
End, Builder, M, NDWord,
505 Builder.SetInsertPoint(
End->getFirstNonPHIIt());
507 Builder.CreateBitCast(ResVec, Type::getX86_AMXTy(Builder.getContext()));
513 I->replaceAllUsesWith(ResVec);
514 I->eraseFromParent();
522template <
bool IsTileLoad>
523bool X86LowerAMXIntrinsics::lowerTileLoadStore(Instruction *TileLoadStore) {
524 Value *
M, *
N, *Ptr, *Stride, *Tile;
536 PreBuilder.SetInsertPoint(TileLoadStore);
537 Value *NDWord = PreBuilder.CreateLShr(
N, PreBuilder.getInt16(2));
538 Value *StrideDWord = PreBuilder.CreateLShr(Stride, PreBuilder.getInt64(2));
543 Value *ResVec = createTileLoadStoreLoops<IsTileLoad>(
544 Start,
End, Builder, M, NDWord, Ptr, StrideDWord,
545 IsTileLoad ?
nullptr : Tile);
549 Builder.SetInsertPoint(
End->getFirstNonPHIIt());
551 Builder.CreateBitCast(ResVec, Type::getX86_AMXTy(Builder.getContext()));
557 I->replaceAllUsesWith(ResVec);
558 I->eraseFromParent();
567bool X86LowerAMXIntrinsics::lowerTileZero(Instruction *TileZero) {
575 I->replaceAllUsesWith(VecZero);
576 I->eraseFromParent();
583bool X86LowerAMXIntrinsics::visit() {
589 switch (Inst->getIntrinsicID()) {
590 case Intrinsic::x86_tdpbssd_internal:
591 case Intrinsic::x86_tdpbsud_internal:
592 case Intrinsic::x86_tdpbusd_internal:
593 case Intrinsic::x86_tdpbuud_internal:
594 case Intrinsic::x86_tileloadd64_internal:
595 case Intrinsic::x86_tilestored64_internal:
596 case Intrinsic::x86_tilezero_internal:
597 case Intrinsic::x86_tdpbf16ps_internal:
607 for (
auto *Inst : WorkList) {
608 switch (Inst->getIntrinsicID()) {
609 case Intrinsic::x86_tdpbssd_internal:
610 C = lowerTileDP<Intrinsic::x86_tdpbssd_internal>(Inst) ||
C;
612 case Intrinsic::x86_tdpbsud_internal:
613 C = lowerTileDP<Intrinsic::x86_tdpbsud_internal>(Inst) ||
C;
615 case Intrinsic::x86_tdpbusd_internal:
616 C = lowerTileDP<Intrinsic::x86_tdpbusd_internal>(Inst) ||
C;
618 case Intrinsic::x86_tdpbuud_internal:
619 C = lowerTileDP<Intrinsic::x86_tdpbuud_internal>(Inst) ||
C;
621 case Intrinsic::x86_tdpbf16ps_internal:
622 C = lowerTileDP<Intrinsic::x86_tdpbf16ps_internal>(Inst) ||
C;
624 case Intrinsic::x86_tileloadd64_internal:
625 C = lowerTileLoadStore<true>(Inst) ||
C;
627 case Intrinsic::x86_tilestored64_internal:
628 C = lowerTileLoadStore<false>(Inst) ||
C;
630 case Intrinsic::x86_tilezero_internal:
631 C = lowerTileZero(Inst) ||
C;
642bool shouldRunLowerAMXIntrinsics(
const Function &
F,
const TargetMachine *TM) {
643 const X86Options &CLOpts =
644 static_cast<const X86TargetMachine *
>(TM)->
getCLOpts();
645 return CLOpts.enable_x86_scalar_amx &&
646 (
F.hasFnAttribute(Attribute::OptimizeNone) ||
650bool runLowerAMXIntrinsics(
Function &
F, DominatorTree *DT, LoopInfo *LI) {
651 DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
653 X86LowerAMXIntrinsics LAT(
F, DTU, LI);
660 if (!shouldRunLowerAMXIntrinsics(
F, TM))
665 bool Changed = runLowerAMXIntrinsics(
F, &DT, &LI);
676class X86LowerAMXIntrinsicsLegacyPass :
public FunctionPass {
684 if (!shouldRunLowerAMXIntrinsics(
F, TM))
687 auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>();
688 auto *DT = DTWP ? &DTWP->getDomTree() :
nullptr;
689 auto *LIWP = getAnalysisIfAvailable<LoopInfoWrapperPass>();
690 auto *LI = LIWP ? &LIWP->getLoopInfo() :
nullptr;
691 return runLowerAMXIntrinsics(
F, DT, LI);
693 StringRef getPassName()
const override {
return "Lower AMX intrinsics"; }
695 void getAnalysisUsage(AnalysisUsage &AU)
const override {
703static const char PassName[] =
"Lower AMX intrinsics";
704char X86LowerAMXIntrinsicsLegacyPass::ID = 0;
712 return new X86LowerAMXIntrinsicsLegacyPass();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static bool runOnFunction(Function &F, bool PostInlining)
This header defines various interfaces for pass management in LLVM.
uint64_t IntrinsicInst * II
FunctionAnalysisManager FAM
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
This file contains the declarations for profiling metadata utility functions.
SmallVector< MachineOperand, 4 > Cond
static void visit(BasicBlock &Start, std::function< bool(BasicBlock *)> op)
Target-Independent Code Generator Pass Configuration Options pass.
static bool isV256I32Ty(Type *Ty)
static const char PassName[]
static const uint32_t IV[8]
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
LLVM Basic Block Representation.
iterator begin()
Instruction iterator methods.
const Function * getParent() const
Return the enclosing method, or null if none.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
LLVM_ABI const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
LLVM_ABI const BasicBlock * getSingleSuccessor() const
Return the successor of this block if it has a single successor.
InstListType::iterator iterator
Instruction iterators...
LLVM_ABI LLVMContext & getContext() const
Get the context in which this basic block lives.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
static CondBrInst * Create(Value *Cond, BasicBlock *IfTrue, BasicBlock *IfFalse, InsertPosition InsertBefore=nullptr)
This is the shared class of boolean and integer constants.
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
Analysis pass which computes a DominatorTree.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
FunctionPass class - This class is used to implement most global optimizations.
void applyUpdatesPermissive(ArrayRef< UpdateT > Updates)
Submit updates to all available trees.
Common base class shared among various IRBuilders.
LLVM_ABI InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
Analysis pass that exposes the LoopInfo for a function.
void addChildLoop(LoopT *NewChild)
Add the specified loop to be a child of this loop.
void addTopLevelLoop(LoopT *New)
This adds the specified loop to the collection of top-level loops.
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
Represents a single loop in the control flow graph.
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserve()
Mark an analysis as preserved.
void push_back(const T &Elt)
Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
CodeGenOptLevel getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
Target-Independent Code Generator Pass Configuration Options.
The instances of the Type class are immutable: once they are created, they are never changed.
void setSuccessor(BasicBlock *NewSucc)
static UncondBrInst * Create(BasicBlock *Target, InsertPosition InsertBefore=nullptr)
BasicBlock * getSuccessor(unsigned i=0) const
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
iterator_range< use_iterator > uses()
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
const ParentTy * getParent() const
Pass manager infrastructure for declaring and invalidating analyses.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const AArch64MCOptions & getCLOpts(const MCTargetOptions &Options)
@ BR
Control flow instructions. These all have token chains.
@ BasicBlock
Various leaf nodes.
bool match(Val *V, const Pattern &P)
auto m_Value()
Match an arbitrary value and ignore it.
CastOperator_match< OpTy, Instruction::BitCast > m_BitCast(const OpTy &Op)
Matches BitCast.
auto m_Intrinsic(const Ts &...Ops)
Match intrinsic calls like this: m_Intrinsic<Intrinsic::fabs>(m_Value(X))
friend class Instruction
Iterator for Instructions in a `BasicBlock.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createX86LowerAMXIntrinsicsLegacyPass()
LLVM_ABI void setExplicitlyUnknownBranchWeightsIfProfiled(Instruction &I, StringRef PassName, const Function *F=nullptr)
Like setExplicitlyUnknownBranchWeights(...), but only sets unknown branch weights in the new instruct...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
IRBuilder(LLVMContext &, FolderTy, InserterTy) -> IRBuilder< FolderTy, InserterTy >
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
LLVM_ABI BasicBlock * SplitBlock(BasicBlock *Old, BasicBlock::iterator SplitPt, DominatorTree *DT, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, const Twine &BBName="")
Split the specified block at the specified instruction.
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
iterator_range< df_iterator< T > > depth_first(const T &G)
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
@ End
Run the machine verifier once, at the end of the pipeline.
LLVM_ABI void setFittedBranchWeights(Instruction &I, ArrayRef< uint64_t > Weights, bool IsExpected, bool ElideAllZero=false)
Variant of setBranchWeights where the Weights will be fit first to uint32_t by shifting right.