43#define DEBUG_TYPE "scalarize-masked-mem-intrin"
47class ScalarizeMaskedMemIntrinLegacyPass :
public FunctionPass {
59 return "Scalarize Masked Memory Intrinsics";
78char ScalarizeMaskedMemIntrinLegacyPass::ID = 0;
81 "Scalarize unsupported masked memory intrinsics",
false,
86 "Scalarize unsupported masked memory intrinsics",
false,
90 return new ScalarizeMaskedMemIntrinLegacyPass();
99 for (
unsigned i = 0; i != NumElts; ++i) {
100 Constant *CElt =
C->getAggregateElement(i);
110 return DL.isBigEndian() ? VectorWidth - 1 - Idx : Idx;
156 Type *EltTy = VecType->getElementType();
162 Builder.SetInsertPoint(InsertPt);
163 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
167 LoadInst *NewI = Builder.CreateAlignedLoad(VecType,
Ptr, AlignVal);
176 const Align AdjustedAlignVal =
181 Value *VResult = Src0;
184 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
185 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
187 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy,
Ptr, Idx);
188 LoadInst *Load = Builder.CreateAlignedLoad(EltTy, Gep, AdjustedAlignVal);
189 VResult = Builder.CreateInsertElement(VResult, Load, Idx);
201 Mask->getName() +
".first");
207 CondBlock->
setName(
"cond.load");
209 LoadInst *Load = Builder.CreateAlignedLoad(VecType,
Ptr, AlignVal,
211 Load->copyMetadata(*CI);
214 Builder.SetInsertPoint(PostLoad, PostLoad->
begin());
215 PHINode *Phi = Builder.CreatePHI(VecType, 2);
216 Phi->addIncoming(Load, CondBlock);
217 Phi->addIncoming(Src0, IfBlock);
228 Value *SclrMask =
nullptr;
229 if (VectorWidth != 1 && !HasBranchDivergence) {
231 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
234 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
245 if (SclrMask !=
nullptr) {
248 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
249 Builder.getIntN(VectorWidth, 0));
251 Predicate = Builder.CreateExtractElement(Mask, Idx);
265 CondBlock->
setName(
"cond.load");
268 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy,
Ptr, Idx);
269 LoadInst *Load = Builder.CreateAlignedLoad(EltTy, Gep, AdjustedAlignVal);
270 Value *NewVResult = Builder.CreateInsertElement(VResult, Load, Idx);
276 IfBlock = NewIfBlock;
279 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
280 PHINode *Phi = Builder.CreatePHI(VecType, 2,
"res.phi.else");
281 Phi->addIncoming(NewVResult, CondBlock);
282 Phi->addIncoming(VResult, PrevIfBlock);
329 Type *EltTy = VecType->getElementType();
333 Builder.SetInsertPoint(InsertPt);
334 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
338 StoreInst *Store = Builder.CreateAlignedStore(Src,
Ptr, AlignVal);
340 Store->copyMetadata(*CI);
346 const Align AdjustedAlignVal =
351 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
352 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
354 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
355 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy,
Ptr, Idx);
356 Builder.CreateAlignedStore(OneElt, Gep, AdjustedAlignVal);
367 Mask->getName() +
".first");
372 CondBlock->
setName(
"cond.store");
375 StoreInst *Store = Builder.CreateAlignedStore(Src,
Ptr, AlignVal);
377 Store->copyMetadata(*CI);
387 Value *SclrMask =
nullptr;
388 if (VectorWidth != 1 && !HasBranchDivergence) {
390 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
393 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
404 if (SclrMask !=
nullptr) {
407 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
408 Builder.getIntN(VectorWidth, 0));
410 Predicate = Builder.CreateExtractElement(Mask, Idx);
424 CondBlock->
setName(
"cond.store");
427 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
428 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy,
Ptr, Idx);
429 Builder.CreateAlignedStore(OneElt, Gep, AdjustedAlignVal);
435 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
472 bool HasBranchDivergence,
CallInst *CI,
480 Type *EltTy = VecType->getElementType();
485 Builder.SetInsertPoint(InsertPt);
488 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
491 Value *VResult = Src0;
492 unsigned VectorWidth = VecType->getNumElements();
496 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
497 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
499 Value *
Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
501 Builder.CreateAlignedLoad(EltTy,
Ptr, AlignVal,
"Load" +
Twine(Idx));
503 Builder.CreateInsertElement(VResult, Load, Idx,
"Res" +
Twine(Idx));
513 Value *SclrMask =
nullptr;
514 if (VectorWidth != 1 && !HasBranchDivergence) {
516 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
519 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
531 if (SclrMask !=
nullptr) {
534 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
535 Builder.getIntN(VectorWidth, 0));
537 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
551 CondBlock->
setName(
"cond.load");
554 Value *
Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
556 Builder.CreateAlignedLoad(EltTy,
Ptr, AlignVal,
"Load" +
Twine(Idx));
558 Builder.CreateInsertElement(VResult, Load, Idx,
"Res" +
Twine(Idx));
564 IfBlock = NewIfBlock;
567 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
568 PHINode *Phi = Builder.CreatePHI(VecType, 2,
"res.phi.else");
569 Phi->addIncoming(NewVResult, CondBlock);
570 Phi->addIncoming(VResult, PrevIfBlock);
607 bool HasBranchDivergence,
CallInst *CI,
619 "Vector of pointers is expected in masked scatter intrinsic");
623 Builder.SetInsertPoint(InsertPt);
624 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
627 unsigned VectorWidth = SrcFVTy->getNumElements();
631 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
632 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
635 Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
636 Value *
Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
637 Builder.CreateAlignedStore(OneElt,
Ptr, AlignVal);
645 Value *SclrMask =
nullptr;
646 if (VectorWidth != 1 && !HasBranchDivergence) {
648 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
651 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
662 if (SclrMask !=
nullptr) {
665 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
666 Builder.getIntN(VectorWidth, 0));
668 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
682 CondBlock->
setName(
"cond.store");
685 Value *OneElt = Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
686 Value *
Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
687 Builder.CreateAlignedStore(OneElt,
Ptr, AlignVal);
693 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
701 bool HasBranchDivergence,
CallInst *CI,
710 Type *EltTy = VecType->getElementType();
716 Builder.SetInsertPoint(InsertPt);
717 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
719 unsigned VectorWidth = VecType->getNumElements();
722 Value *VResult = PassThru;
725 const Align AdjustedAlignment =
732 unsigned MemIndex = 0;
735 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
737 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue()) {
739 ShuffleMask[Idx] = Idx + VectorWidth;
742 Builder.CreateConstInBoundsGEP1_32(EltTy,
Ptr, MemIndex);
743 InsertElt = Builder.CreateAlignedLoad(EltTy, NewPtr, AdjustedAlignment,
744 "Load" +
Twine(Idx));
745 ShuffleMask[Idx] = Idx;
748 VResult = Builder.CreateInsertElement(VResult, InsertElt, Idx,
751 VResult = Builder.CreateShuffleVector(VResult, PassThru, ShuffleMask);
760 Value *SclrMask =
nullptr;
761 if (VectorWidth != 1 && !HasBranchDivergence) {
763 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
766 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
778 if (SclrMask !=
nullptr) {
781 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
782 Builder.getIntN(VectorWidth, 0));
784 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
798 CondBlock->
setName(
"cond.load");
801 LoadInst *Load = Builder.CreateAlignedLoad(EltTy,
Ptr, AdjustedAlignment);
802 Value *NewVResult = Builder.CreateInsertElement(VResult, Load, Idx);
806 if ((Idx + 1) != VectorWidth)
807 NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy,
Ptr, 1);
813 IfBlock = NewIfBlock;
816 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
817 PHINode *ResultPhi = Builder.CreatePHI(VecType, 2,
"res.phi.else");
823 if ((Idx + 1) != VectorWidth) {
824 PHINode *PtrPhi = Builder.CreatePHI(
Ptr->getType(), 2,
"ptr.phi.else");
838 bool HasBranchDivergence,
CallInst *CI,
852 Builder.SetInsertPoint(InsertPt);
853 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
855 Type *EltTy = VecType->getElementType();
858 const Align AdjustedAlignment =
861 unsigned VectorWidth = VecType->getNumElements();
865 unsigned MemIndex = 0;
866 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
867 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
870 Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
871 Value *NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy,
Ptr, MemIndex);
872 Builder.CreateAlignedStore(OneElt, NewPtr, AdjustedAlignment);
882 Value *SclrMask =
nullptr;
883 if (VectorWidth != 1 && !HasBranchDivergence) {
885 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
888 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
898 if (SclrMask !=
nullptr) {
901 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
902 Builder.getIntN(VectorWidth, 0));
904 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
918 CondBlock->
setName(
"cond.store");
921 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
922 Builder.CreateAlignedStore(OneElt,
Ptr, AdjustedAlignment);
926 if ((Idx + 1) != VectorWidth)
927 NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy,
Ptr, 1);
933 IfBlock = NewIfBlock;
935 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
938 if ((Idx + 1) != VectorWidth) {
939 PHINode *PtrPhi = Builder.CreatePHI(
Ptr->getType(), 2,
"ptr.phi.else");
965 Builder.SetInsertPoint(InsertPt);
967 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
970 unsigned VectorWidth = AddrType->getNumElements();
975 case Intrinsic::experimental_vector_histogram_add:
976 UpdateOp = Builder.CreateAdd(Load, Inc);
978 case Intrinsic::experimental_vector_histogram_uadd_sat:
980 Builder.CreateIntrinsic(Intrinsic::uadd_sat, {EltTy}, {Load, Inc});
982 case Intrinsic::experimental_vector_histogram_umin:
983 UpdateOp = Builder.CreateIntrinsic(Intrinsic::umin, {EltTy}, {Load, Inc});
985 case Intrinsic::experimental_vector_histogram_umax:
986 UpdateOp = Builder.CreateIntrinsic(Intrinsic::umax, {EltTy}, {Load, Inc});
997 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
998 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
1000 Value *
Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
1004 Builder.CreateStore(Update,
Ptr);
1010 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
1012 Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
1019 CondBlock->
setName(
"cond.histogram.update");
1022 Value *
Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
1026 Builder.CreateStore(UpdateOp,
Ptr);
1031 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
1040 std::optional<DomTreeUpdater> DTU;
1042 DTU.emplace(DT, DomTreeUpdater::UpdateStrategy::Lazy);
1044 bool EverMadeChange =
false;
1045 bool MadeChange =
true;
1046 auto &
DL =
F.getDataLayout();
1047 bool HasBranchDivergence =
TTI.hasBranchDivergence(&
F);
1048 while (MadeChange) {
1051 bool ModifiedDTOnIteration =
false;
1053 HasBranchDivergence, DTU ? &*DTU :
nullptr);
1056 if (ModifiedDTOnIteration)
1060 EverMadeChange |= MadeChange;
1062 return EverMadeChange;
1065bool ScalarizeMaskedMemIntrinLegacyPass::runOnFunction(
Function &
F) {
1066 auto &
TTI = getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
F);
1067 DominatorTree *DT =
nullptr;
1068 if (
auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>())
1069 DT = &DTWP->getDomTree();
1088 bool MadeChange =
false;
1091 while (CurInstIterator != BB.
end()) {
1111 [](
Value *V) { return isa<ScalableVectorType>(V->getType()); }))
1113 switch (
II->getIntrinsicID()) {
1116 case Intrinsic::experimental_vector_histogram_add:
1117 case Intrinsic::experimental_vector_histogram_uadd_sat:
1118 case Intrinsic::experimental_vector_histogram_umin:
1119 case Intrinsic::experimental_vector_histogram_umax:
1125 case Intrinsic::masked_load:
1127 if (
TTI.isLegalMaskedLoad(
1131 ->getAddressSpace()))
1135 case Intrinsic::masked_store:
1136 if (
TTI.isLegalMaskedStore(
1140 ->getAddressSpace()))
1144 case Intrinsic::masked_gather: {
1148 Align Alignment =
DL.getValueOrABITypeAlignment(MA,
1150 if (
TTI.isLegalMaskedGather(LoadTy, Alignment) &&
1156 case Intrinsic::masked_scatter: {
1160 Align Alignment =
DL.getValueOrABITypeAlignment(MA,
1162 if (
TTI.isLegalMaskedScatter(StoreTy, Alignment) &&
1169 case Intrinsic::masked_expandload:
1170 if (
TTI.isLegalMaskedExpandLoad(
1172 CI->
getAttributes().getParamAttrs(0).getAlignment().valueOrOne()))
1176 case Intrinsic::masked_compressstore:
1177 if (
TTI.isLegalMaskedCompressStore(
1179 CI->
getAttributes().getParamAttrs(1).getAlignment().valueOrOne()))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool runOnFunction(Function &F, bool PostInlining)
static bool runImpl(Function &F, const TargetLowering &TLI, AssumptionCache *AC)
uint64_t IntrinsicInst * II
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
static void scalarizeMaskedExpandLoad(const DataLayout &DL, bool HasBranchDivergence, CallInst *CI, DomTreeUpdater *DTU, bool &ModifiedDT)
static void scalarizeMaskedVectorHistogram(const DataLayout &DL, CallInst *CI, DomTreeUpdater *DTU, bool &ModifiedDT)
static bool optimizeBlock(BasicBlock &BB, bool &ModifiedDT, const TargetTransformInfo &TTI, const DataLayout &DL, bool HasBranchDivergence, DomTreeUpdater *DTU)
static void scalarizeMaskedScatter(const DataLayout &DL, bool HasBranchDivergence, CallInst *CI, DomTreeUpdater *DTU, bool &ModifiedDT)
static unsigned adjustForEndian(const DataLayout &DL, unsigned VectorWidth, unsigned Idx)
static bool optimizeCallInst(CallInst *CI, bool &ModifiedDT, const TargetTransformInfo &TTI, const DataLayout &DL, bool HasBranchDivergence, DomTreeUpdater *DTU)
static void scalarizeMaskedStore(const DataLayout &DL, bool HasBranchDivergence, CallInst *CI, DomTreeUpdater *DTU, bool &ModifiedDT)
static void scalarizeMaskedCompressStore(const DataLayout &DL, bool HasBranchDivergence, CallInst *CI, DomTreeUpdater *DTU, bool &ModifiedDT)
static void scalarizeMaskedGather(const DataLayout &DL, bool HasBranchDivergence, CallInst *CI, DomTreeUpdater *DTU, bool &ModifiedDT)
static bool runImpl(Function &F, const TargetTransformInfo &TTI, DominatorTree *DT)
static bool isConstantIntVector(Value *Mask)
static void scalarizeMaskedLoad(const DataLayout &DL, bool HasBranchDivergence, CallInst *CI, DomTreeUpdater *DTU, bool &ModifiedDT)
static APInt getOneBitSet(unsigned numBits, unsigned BitNo)
Return an APInt with exactly one bit set in the result.
PassT::Result * getCachedResult(IRUnitT &IR) const
Get the cached result of an analysis pass for a given IR unit.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
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.
InstListType::iterator iterator
Instruction iterators...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
MaybeAlign getParamAlign(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
Value * getArgOperand(unsigned i) const
LLVM_ABI Intrinsic::ID getIntrinsicID() const
Returns the intrinsic ID of the intrinsic called or Intrinsic::not_intrinsic if the called function i...
AttributeList getAttributes() const
Return the attributes for this call.
This class represents a function call, abstracting a target machine's calling convention.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
Analysis pass which computes a DominatorTree.
Legacy analysis pass which computes a DominatorTree.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
FunctionPass class - This class is used to implement most global optimizations.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
LLVM_ABI InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
LLVM_ABI BasicBlock * getSuccessor(unsigned Idx) const LLVM_READONLY
Return the specified successor. This instruction must be a terminator.
LLVM_ABI void copyMetadata(const Instruction &SrcInst, ArrayRef< unsigned > WL=ArrayRef< unsigned >())
Copy metadata from SrcInst to this instruction.
A wrapper class for inspecting calls to intrinsic functions.
An instruction for reading from memory.
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserve()
Mark an analysis as preserved.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
StringRef - Represent a constant reference to a string, i.e.
Analysis pass providing the TargetTransformInfo.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
LLVM_ABI TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
static LLVM_ABI IntegerType * getIntNTy(LLVMContext &C, unsigned N)
bool isVoidTy() const
Return true if this is 'void'.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI void setName(const Twine &Name)
Change the name of the value.
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
LLVM_ABI LLVMContext & getContext() const
All values hold a context through their type.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
LLVM_ABI void takeName(Value *V)
Transfer the name from V to this value.
const ParentTy * getParent() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
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...
LLVM_ABI FunctionPass * createScalarizeMaskedMemIntrinLegacyPass()
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI bool isSplatValue(const Value *V, int Index=-1, unsigned Depth=0)
Return true if each element of the vector value V is poisoned or equal to every other non-poisoned el...
LLVM_ABI void initializeScalarizeMaskedMemIntrinLegacyPassPass(PassRegistry &)
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
constexpr int PoisonMaskElem
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Align commonAlignment(Align A, uint64_t Offset)
Returns the alignment that satisfies both alignments.
LLVM_ABI Instruction * SplitBlockAndInsertIfThen(Value *Cond, BasicBlock::iterator SplitBefore, bool Unreachable, MDNode *BranchWeights=nullptr, DomTreeUpdater *DTU=nullptr, LoopInfo *LI=nullptr, BasicBlock *ThenBlock=nullptr)
Split the containing block at the specified instruction - everything before SplitBefore stays in the ...
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
This struct is a compact representation of a valid (non-zero power of two) alignment.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Align valueOrOne() const
For convenience, returns a valid alignment or 1 if undefined.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)