34#include "llvm/IR/IntrinsicsX86.h"
48#define DEBUG_TYPE "x86-lower-amx-intrinsics"
53 return FVT->getNumElements() == 256 &&
54 FVT->getElementType()->isIntegerTy(32);
60class X86LowerAMXIntrinsics {
64 X86LowerAMXIntrinsics(
Function &
F, DomTreeUpdater &DomTU, LoopInfo *LoopI)
65 : Func(
F), DTU(DomTU), LI(LoopI) {}
71 BasicBlock *createLoop(BasicBlock *Preheader, BasicBlock *Exit,
Value *Bound,
72 ConstantInt *Step, StringRef Name, IRBuilderBase &
B,
74 template <
bool IsTileLoad>
75 Value *createTileLoadStoreLoops(BasicBlock *Start, BasicBlock *
End,
78 template <Intrinsic::ID IntrID>
79 std::enable_if_t<IntrID == Intrinsic::x86_tdpbssd_internal ||
80 IntrID == Intrinsic::x86_tdpbsud_internal ||
81 IntrID == Intrinsic::x86_tdpbusd_internal ||
82 IntrID == Intrinsic::x86_tdpbuud_internal ||
83 IntrID == Intrinsic::x86_tdpbf16ps_internal,
85 createTileDPLoops(BasicBlock *Start, BasicBlock *
End, IRBuilderBase &
B,
88 template <
bool IsTileLoad>
89 bool lowerTileLoadStore(Instruction *TileLoadStore);
90 template <Intrinsic::ID IntrID>
91 std::enable_if_t<IntrID == Intrinsic::x86_tdpbssd_internal ||
92 IntrID == Intrinsic::x86_tdpbsud_internal ||
93 IntrID == Intrinsic::x86_tdpbusd_internal ||
94 IntrID == Intrinsic::x86_tdpbuud_internal ||
95 IntrID == Intrinsic::x86_tdpbf16ps_internal,
97 lowerTileDP(Instruction *TileDP);
98 bool lowerTileZero(Instruction *TileZero);
114 Type *I16Ty = Type::getInt16Ty(Ctx);
118 PHINode::Create(I16Ty, 2, Name +
".iv", Header->getTerminator()->getIterator());
119 IV->addIncoming(ConstantInt::get(I16Ty, 0), Preheader);
121 B.SetInsertPoint(Latch);
122 Value *Inc =
B.CreateAdd(
IV, Step, Name +
".step");
123 Value *
Cond =
B.CreateICmpNE(Inc, Bound, Name +
".cond");
127 "Expected a non-zero step size. This is chosen by the pass and "
128 "should always be non-zero to imply a finite loop.");
131 *BR, {BoundInt->getZExtValue() / Step->
getZExtValue(), 1},
false);
135 IV->addIncoming(Inc, Latch);
141 {DominatorTree::Delete, Preheader, Tmp},
142 {DominatorTree::Insert, Header, Body},
143 {DominatorTree::Insert, Body, Latch},
144 {DominatorTree::Insert, Latch, Header},
145 {DominatorTree::Insert, Latch,
Exit},
146 {DominatorTree::Insert, Preheader, Header},
149 L->addBasicBlockToLoop(Header, *LI);
150 L->addBasicBlockToLoop(Body, *LI);
151 L->addBasicBlockToLoop(Latch, *LI);
156template <
bool IsTileLoad>
157Value *X86LowerAMXIntrinsics::createTileLoadStoreLoops(
158 BasicBlock *Start, BasicBlock *
End, IRBuilderBase &
B,
Value *Row,
160 std::string IntrinName = IsTileLoad ?
"tileload" :
"tilestore";
161 Loop *RowLoop =
nullptr;
162 Loop *ColLoop =
nullptr;
168 ParentL->addChildLoop(RowLoop);
174 IntrinName +
".scalarize.rows",
B, RowLoop);
177 BasicBlock *ColBody = createLoop(RowBody, RowLatch, Col,
B.getInt16(1),
178 IntrinName +
".scalarize.cols",
B, ColLoop);
185 Type *EltTy =
B.getInt32Ty();
192 Value *CurrentRowZExt =
B.CreateZExt(CurrentRow, Stride->
getType());
193 Value *CurrentColZExt =
B.CreateZExt(CurrentCol, Stride->
getType());
195 B.CreateAdd(
B.CreateMul(CurrentRowZExt, Stride), CurrentColZExt);
197 Value *
Idx =
B.CreateAdd(
B.CreateMul(CurrentRow,
B.getInt16(16)), CurrentCol);
204 PHINode *VecCPhiRowLoop =
B.CreatePHI(V256I32Ty, 2,
"vec.phi.row");
211 PHINode *VecPhi =
B.CreatePHI(V256I32Ty, 2,
"vec.phi");
220 Value *Elt =
B.CreateLoad(EltTy, EltPtr);
221 Value *ResVec =
B.CreateInsertElement(VecPhi, Elt, Idx);
228 Value *Vec = BitCast->getOperand(0);
236 Value *Elt =
B.CreateExtractElement(Vec, Idx);
238 B.CreateStore(Elt, EltPtr);
243template <Intrinsic::ID IntrID>
244std::enable_if_t<IntrID == Intrinsic::x86_tdpbssd_internal ||
245 IntrID == Intrinsic::x86_tdpbsud_internal ||
246 IntrID == Intrinsic::x86_tdpbusd_internal ||
247 IntrID == Intrinsic::x86_tdpbuud_internal ||
248 IntrID == Intrinsic::x86_tdpbf16ps_internal,
250X86LowerAMXIntrinsics::createTileDPLoops(BasicBlock *Start, BasicBlock *
End,
251 IRBuilderBase &
B,
Value *Row,
254 std::string IntrinName;
256 case Intrinsic::x86_tdpbssd_internal:
257 IntrinName =
"tiledpbssd";
259 case Intrinsic::x86_tdpbsud_internal:
260 IntrinName =
"tiledpbsud";
262 case Intrinsic::x86_tdpbusd_internal:
263 IntrinName =
"tiledpbusd";
265 case Intrinsic::x86_tdpbuud_internal:
266 IntrinName =
"tiledpbuud";
268 case Intrinsic::x86_tdpbf16ps_internal:
269 IntrinName =
"tiledpbf16ps";
272 Loop *RowLoop =
nullptr;
273 Loop *ColLoop =
nullptr;
274 Loop *InnerLoop =
nullptr;
282 ParentL->addChildLoop(RowLoop);
288 IntrinName +
".scalarize.rows",
B, RowLoop);
291 BasicBlock *ColBody = createLoop(RowBody, RowLatch, Col,
B.getInt16(1),
292 IntrinName +
".scalarize.cols",
B, ColLoop);
298 createLoop(ColBody, ColLoopLatch, K,
B.getInt16(1),
299 IntrinName +
".scalarize.inner",
B, InnerLoop);
307 Value *CurrentInner = &*InnerLoopHeader->
begin();
311 Value *VecC = BitCastAcc->getOperand(0);
317 Value *VecA = BitCastLHS->getOperand(0);
320 Value *VecB = BitCastRHS->getOperand(0);
330 PHINode *VecCPhiRowLoop =
B.CreatePHI(V256I32Ty, 2,
"vec.c.phi.row");
333 PHINode *VecDPhiRowLoop =
B.CreatePHI(V256I32Ty, 2,
"vec.d.phi.row");
347 PHINode *VecCPhiColLoop =
B.CreatePHI(V256I32Ty, 2,
"vec.c.phi.col");
348 VecCPhiColLoop->
addIncoming(VecCPhiRowLoop, RowBody);
349 PHINode *VecDPhiColLoop =
B.CreatePHI(V256I32Ty, 2,
"vec.d.phi.col");
350 VecDPhiColLoop->
addIncoming(VecDPhiRowLoop, RowBody);
352 B.CreateAdd(
B.CreateMul(CurrentRow,
B.getInt16(16)), CurrentCol);
360 PHINode *VecCPhi =
B.CreatePHI(V256I32Ty, 2,
"vec.c.inner.phi");
365 B.CreateAdd(
B.CreateMul(CurrentRow,
B.getInt16(16)), CurrentInner);
367 B.CreateAdd(
B.CreateMul(CurrentInner,
B.getInt16(16)), CurrentCol);
368 Value *NewVecC =
nullptr;
370 if (IntrID != Intrinsic::x86_tdpbf16ps_internal) {
387 Value *EltC =
B.CreateExtractElement(VecCPhi, IdxC);
388 Value *EltA =
B.CreateExtractElement(VecA, IdxA);
389 Value *SubVecA =
B.CreateBitCast(EltA, V4I8Ty);
390 Value *EltB =
B.CreateExtractElement(VecB, IdxB);
391 Value *SubVecB =
B.CreateBitCast(EltB, V4I8Ty);
392 Value *SEXTSubVecB =
nullptr;
393 Value *SEXTSubVecA =
nullptr;
395 case Intrinsic::x86_tdpbssd_internal:
396 SEXTSubVecB =
B.CreateSExt(SubVecB, V4I32Ty);
397 SEXTSubVecA =
B.CreateSExt(SubVecA, V4I32Ty);
399 case Intrinsic::x86_tdpbsud_internal:
400 SEXTSubVecB =
B.CreateZExt(SubVecB, V4I32Ty);
401 SEXTSubVecA =
B.CreateSExt(SubVecA, V4I32Ty);
403 case Intrinsic::x86_tdpbusd_internal:
404 SEXTSubVecB =
B.CreateSExt(SubVecB, V4I32Ty);
405 SEXTSubVecA =
B.CreateZExt(SubVecA, V4I32Ty);
407 case Intrinsic::x86_tdpbuud_internal:
408 SEXTSubVecB =
B.CreateZExt(SubVecB, V4I32Ty);
409 SEXTSubVecA =
B.CreateZExt(SubVecA, V4I32Ty);
414 Value *SubVecR =
B.CreateAddReduce(
B.CreateMul(SEXTSubVecA, SEXTSubVecB));
415 Value *ResElt =
B.CreateAdd(EltC, SubVecR);
416 NewVecC =
B.CreateInsertElement(VecCPhi, ResElt, IdxC);
442 Value *EltC =
B.CreateExtractElement(VecCPhi, IdxC);
443 Value *EltCF32 =
B.CreateBitCast(EltC,
B.getFloatTy());
444 Value *EltA =
B.CreateExtractElement(VecA, IdxA);
445 Value *SubVecA =
B.CreateBitCast(EltA, V2I16Ty);
446 Value *EltB =
B.CreateExtractElement(VecB, IdxB);
447 Value *SubVecB =
B.CreateBitCast(EltB, V2I16Ty);
449 int ShuffleMask[4] = {2, 0, 3, 1};
450 auto ShuffleArray =
ArrayRef(ShuffleMask);
451 Value *AV2F32 =
B.CreateBitCast(
452 B.CreateShuffleVector(SubVecA, ZeroV2I16, ShuffleArray), V2F32Ty);
453 Value *BV2F32 =
B.CreateBitCast(
454 B.CreateShuffleVector(SubVecB, ZeroV2I16, ShuffleArray), V2F32Ty);
455 Value *SubVecR =
B.CreateFAddReduce(EltCF32,
B.CreateFMul(AV2F32, BV2F32));
456 Value *ResElt =
B.CreateBitCast(SubVecR,
B.getInt32Ty());
457 NewVecC =
B.CreateInsertElement(VecCPhi, ResElt, IdxC);
465 Value *NewEltC =
B.CreateExtractElement(NewVecC, IdxC);
466 Value *NewVecD =
B.CreateInsertElement(VecDPhiColLoop, NewEltC, IdxC);
470 VecCPhiColLoop->
addIncoming(NewVecC, ColLoopLatch);
472 VecDPhiColLoop->
addIncoming(NewVecD, ColLoopLatch);
477template <Intrinsic::ID IntrID>
478std::enable_if_t<IntrID == Intrinsic::x86_tdpbssd_internal ||
479 IntrID == Intrinsic::x86_tdpbsud_internal ||
480 IntrID == Intrinsic::x86_tdpbusd_internal ||
481 IntrID == Intrinsic::x86_tdpbuud_internal ||
482 IntrID == Intrinsic::x86_tdpbf16ps_internal,
484X86LowerAMXIntrinsics::lowerTileDP(Instruction *TileDP) {
490 PreBuilder.SetInsertPoint(TileDP);
494 Value *NDWord = PreBuilder.CreateLShr(
N, PreBuilder.getInt16(2));
495 Value *KDWord = PreBuilder.CreateLShr(K, PreBuilder.getInt16(2));
500 Value *ResVec = createTileDPLoops<IntrID>(Start,
End, Builder, M, NDWord,
504 Builder.SetInsertPoint(
End->getFirstNonPHIIt());
506 Builder.CreateBitCast(ResVec, Type::getX86_AMXTy(Builder.getContext()));
512 I->replaceAllUsesWith(ResVec);
513 I->eraseFromParent();
521template <
bool IsTileLoad>
522bool X86LowerAMXIntrinsics::lowerTileLoadStore(Instruction *TileLoadStore) {
523 Value *
M, *
N, *Ptr, *Stride, *Tile;
535 PreBuilder.SetInsertPoint(TileLoadStore);
536 Value *NDWord = PreBuilder.CreateLShr(
N, PreBuilder.getInt16(2));
537 Value *StrideDWord = PreBuilder.CreateLShr(Stride, PreBuilder.getInt64(2));
542 Value *ResVec = createTileLoadStoreLoops<IsTileLoad>(
543 Start,
End, Builder, M, NDWord, Ptr, StrideDWord,
544 IsTileLoad ?
nullptr : Tile);
548 Builder.SetInsertPoint(
End->getFirstNonPHIIt());
550 Builder.CreateBitCast(ResVec, Type::getX86_AMXTy(Builder.getContext()));
556 I->replaceAllUsesWith(ResVec);
557 I->eraseFromParent();
566bool X86LowerAMXIntrinsics::lowerTileZero(Instruction *TileZero) {
574 I->replaceAllUsesWith(VecZero);
575 I->eraseFromParent();
582bool X86LowerAMXIntrinsics::visit() {
588 switch (Inst->getIntrinsicID()) {
589 case Intrinsic::x86_tdpbssd_internal:
590 case Intrinsic::x86_tdpbsud_internal:
591 case Intrinsic::x86_tdpbusd_internal:
592 case Intrinsic::x86_tdpbuud_internal:
593 case Intrinsic::x86_tileloadd64_internal:
594 case Intrinsic::x86_tilestored64_internal:
595 case Intrinsic::x86_tilezero_internal:
596 case Intrinsic::x86_tdpbf16ps_internal:
606 for (
auto *Inst : WorkList) {
607 switch (Inst->getIntrinsicID()) {
608 case Intrinsic::x86_tdpbssd_internal:
609 C = lowerTileDP<Intrinsic::x86_tdpbssd_internal>(Inst) ||
C;
611 case Intrinsic::x86_tdpbsud_internal:
612 C = lowerTileDP<Intrinsic::x86_tdpbsud_internal>(Inst) ||
C;
614 case Intrinsic::x86_tdpbusd_internal:
615 C = lowerTileDP<Intrinsic::x86_tdpbusd_internal>(Inst) ||
C;
617 case Intrinsic::x86_tdpbuud_internal:
618 C = lowerTileDP<Intrinsic::x86_tdpbuud_internal>(Inst) ||
C;
620 case Intrinsic::x86_tdpbf16ps_internal:
621 C = lowerTileDP<Intrinsic::x86_tdpbf16ps_internal>(Inst) ||
C;
623 case Intrinsic::x86_tileloadd64_internal:
624 C = lowerTileLoadStore<true>(Inst) ||
C;
626 case Intrinsic::x86_tilestored64_internal:
627 C = lowerTileLoadStore<false>(Inst) ||
C;
629 case Intrinsic::x86_tilezero_internal:
630 C = lowerTileZero(Inst) ||
C;
641bool shouldRunLowerAMXIntrinsics(
const Function &
F,
const TargetMachine *TM) {
642 const X86Options &CLOpts =
643 static_cast<const X86TargetMachine *
>(TM)->
getCLOpts();
644 return CLOpts.enable_x86_scalar_amx &&
645 (
F.hasFnAttribute(Attribute::OptimizeNone) ||
649bool runLowerAMXIntrinsics(
Function &
F, DominatorTree *DT, LoopInfo *LI) {
650 DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
652 X86LowerAMXIntrinsics LAT(
F, DTU, LI);
659 if (!shouldRunLowerAMXIntrinsics(
F, TM))
664 bool Changed = runLowerAMXIntrinsics(
F, &DT, &LI);
675class X86LowerAMXIntrinsicsLegacyPass :
public FunctionPass {
683 if (!shouldRunLowerAMXIntrinsics(
F, TM))
686 auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>();
687 auto *DT = DTWP ? &DTWP->getDomTree() :
nullptr;
688 auto *LIWP = getAnalysisIfAvailable<LoopInfoWrapperPass>();
689 auto *LI = LIWP ? &LIWP->getLoopInfo() :
nullptr;
690 return runLowerAMXIntrinsics(
F, DT, LI);
692 StringRef getPassName()
const override {
return "Lower AMX intrinsics"; }
694 void getAnalysisUsage(AnalysisUsage &AU)
const override {
702static const char PassName[] =
"Lower AMX intrinsics";
703char X86LowerAMXIntrinsicsLegacyPass::ID = 0;
711 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.
SmallVector< MachineOperand, 4 > Cond
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.
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.