45#define DEBUG_TYPE "scalarize-masked-mem-intrin"
49class ScalarizeMaskedMemIntrinLegacyPass :
public FunctionPass {
53 explicit ScalarizeMaskedMemIntrinLegacyPass() :
FunctionPass(ID) {
61 return "Scalarize Masked Memory Intrinsics";
80char ScalarizeMaskedMemIntrinLegacyPass::ID = 0;
83 "Scalarize unsupported masked memory intrinsics",
false,
88 "Scalarize unsupported masked memory intrinsics",
false,
92 return new ScalarizeMaskedMemIntrinLegacyPass();
101 for (
unsigned i = 0; i != NumElts; ++i) {
102 Constant *CElt =
C->getAggregateElement(i);
112 return DL.isBigEndian() ? VectorWidth - 1 - Idx : Idx;
116 unsigned SourcePtrOperand,
117 unsigned DestPtrOperand) {
118 MDNode *CacheHint = Source.getMetadata(LLVMContext::MD_mem_cache_hint);
124 if (OperandNo->getZExtValue() != SourcePtrOperand)
131 {DestOperandNo, CacheHint->getOperand(1)}));
136 unsigned SourcePtrOperand,
unsigned DestPtrOperand,
Type *AccessType,
137 bool IsWholeAccess, std::optional<size_t> ByteOffset) {
142 {LLVMContext::MD_nontemporal,
143 LLVMContext::MD_mem_parallel_loop_access,
144 LLVMContext::MD_access_group, LLVMContext::MD_annotation,
145 LLVMContext::MD_nosanitize, LLVMContext::MD_mmra});
147 AAMDNodes AANodes = Source.getAAMetadata();
164 unsigned SourcePtrOperand,
165 std::optional<size_t> ByteOffset) {
168 Dest.
getType() == Source.getType(), ByteOffset);
172 Dest.
copyMetadata(Source, {LLVMContext::MD_fpmath, LLVMContext::MD_range,
173 LLVMContext::MD_invariant_load});
179 unsigned SourcePtrOperand,
180 std::optional<size_t> ByteOffset) {
230 Type *EltTy = VecType->getElementType();
234 Builder.disableGEPCanonicalization();
239 LoadInst *NewI = Builder.CreateAlignedLoad(VecType, Ptr, AlignVal);
249 const Align AdjustedAlignVal =
254 Value *VResult = Src0;
257 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
258 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
260 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, Idx);
261 LoadInst *
Load = Builder.CreateAlignedLoad(EltTy, Gep, AdjustedAlignVal);
264 Idx *
DL.getTypeAllocSize(EltTy).getFixedValue());
265 VResult = Builder.CreateInsertElement(VResult,
Load, Idx);
277 Mask->getName() +
".first");
287 CondBlock->
setName(
"cond.load");
289 LoadInst *
Load = Builder.CreateAlignedLoad(VecType, Ptr, AlignVal,
295 Builder.SetInsertPoint(PostLoad->
begin());
296 PHINode *Phi = Builder.CreatePHI(VecType, 2);
297 Phi->addIncoming(
Load, CondBlock);
298 Phi->addIncoming(Src0, IfBlock);
309 Value *SclrMask =
nullptr;
310 if (VectorWidth != 1 && !HasBranchDivergence) {
312 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
315 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
326 if (SclrMask !=
nullptr) {
329 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
330 Builder.getIntN(VectorWidth, 0));
332 Predicate = Builder.CreateExtractElement(Mask, Idx);
350 CondBlock->
setName(
"cond.load");
353 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, Idx);
354 LoadInst *
Load = Builder.CreateAlignedLoad(EltTy, Gep, AdjustedAlignVal);
357 Idx *
DL.getTypeAllocSize(EltTy).getFixedValue());
358 Value *NewVResult = Builder.CreateInsertElement(VResult,
Load, Idx);
364 IfBlock = NewIfBlock;
367 Builder.SetInsertPoint(NewIfBlock->
begin());
368 PHINode *Phi = Builder.CreatePHI(VecType, 2,
"res.phi.else");
369 Phi->addIncoming(NewVResult, CondBlock);
370 Phi->addIncoming(VResult, PrevIfBlock);
416 Type *EltTy = VecType->getElementType();
420 Builder.disableGEPCanonicalization();
424 StoreInst *
Store = Builder.CreateAlignedStore(Src, Ptr, AlignVal);
429 Store->copyMetadata(*CI, LLVMContext::MD_DIAssignID);
435 const Align AdjustedAlignVal =
440 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
441 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
443 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
444 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, Idx);
446 Builder.CreateAlignedStore(OneElt, Gep, AdjustedAlignVal);
449 Idx *
DL.getTypeAllocSize(EltTy).getFixedValue());
460 Mask->getName() +
".first");
469 CondBlock->
setName(
"cond.store");
472 StoreInst *
Store = Builder.CreateAlignedStore(Src, Ptr, AlignVal);
477 Store->copyMetadata(*CI, LLVMContext::MD_DIAssignID);
487 Value *SclrMask =
nullptr;
488 if (VectorWidth != 1 && !HasBranchDivergence) {
490 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
493 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
504 if (SclrMask !=
nullptr) {
507 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
508 Builder.getIntN(VectorWidth, 0));
510 Predicate = Builder.CreateExtractElement(Mask, Idx);
528 CondBlock->
setName(
"cond.store");
531 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
532 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, Idx);
534 Builder.CreateAlignedStore(OneElt, Gep, AdjustedAlignVal);
537 Idx *
DL.getTypeAllocSize(EltTy).getFixedValue());
543 Builder.SetInsertPoint(NewIfBlock->
begin());
580 bool HasBranchDivergence,
CallInst *CI,
587 Type *EltTy = VecType->getElementType();
595 Value *VResult = Src0;
596 unsigned VectorWidth = VecType->getNumElements();
600 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
601 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
603 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
605 Builder.CreateAlignedLoad(EltTy, Ptr, AlignVal,
"Load" +
Twine(Idx));
609 Builder.CreateInsertElement(VResult,
Load, Idx,
"Res" +
Twine(Idx));
619 Value *SclrMask =
nullptr;
620 if (VectorWidth != 1 && !HasBranchDivergence) {
622 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
625 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
637 if (SclrMask !=
nullptr) {
640 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
641 Builder.getIntN(VectorWidth, 0));
643 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
661 CondBlock->
setName(
"cond.load");
664 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
666 Builder.CreateAlignedLoad(EltTy, Ptr, AlignVal,
"Load" +
Twine(Idx));
670 Builder.CreateInsertElement(VResult,
Load, Idx,
"Res" +
Twine(Idx));
676 IfBlock = NewIfBlock;
679 Builder.SetInsertPoint(NewIfBlock->
begin());
680 PHINode *Phi = Builder.CreatePHI(VecType, 2,
"res.phi.else");
681 Phi->addIncoming(NewVResult, CondBlock);
682 Phi->addIncoming(VResult, PrevIfBlock);
719 bool HasBranchDivergence,
CallInst *CI,
730 "Vector of pointers is expected in masked scatter intrinsic");
736 unsigned VectorWidth = SrcFVTy->getNumElements();
740 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
741 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
744 Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
745 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
746 StoreInst *
Store = Builder.CreateAlignedStore(OneElt, Ptr, AlignVal);
757 Value *SclrMask =
nullptr;
758 if (VectorWidth != 1 && !HasBranchDivergence) {
760 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
763 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
774 if (SclrMask !=
nullptr) {
777 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
778 Builder.getIntN(VectorWidth, 0));
780 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
798 CondBlock->
setName(
"cond.store");
801 Value *OneElt = Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
802 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
803 StoreInst *
Store = Builder.CreateAlignedStore(OneElt, Ptr, AlignVal);
812 Builder.SetInsertPoint(NewIfBlock->
begin());
820 bool HasBranchDivergence,
CallInst *CI,
829 Type *EltTy = VecType->getElementType();
833 Builder.disableGEPCanonicalization();
836 unsigned VectorWidth = VecType->getNumElements();
839 Value *VResult = PassThru;
842 const Align AdjustedAlignment =
849 unsigned MemIndex = 0;
852 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
854 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue()) {
856 ShuffleMask[Idx] = Idx + VectorWidth;
859 Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, MemIndex);
861 EltTy, NewPtr, AdjustedAlignment,
"Load" +
Twine(Idx));
864 MemIndex *
DL.getTypeAllocSize(EltTy).getFixedValue());
866 ShuffleMask[Idx] = Idx;
869 VResult = Builder.CreateInsertElement(VResult, InsertElt, Idx,
872 VResult = Builder.CreateShuffleVector(VResult, PassThru, ShuffleMask);
881 Value *SclrMask =
nullptr;
882 if (VectorWidth != 1 && !HasBranchDivergence) {
884 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
887 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
899 if (SclrMask !=
nullptr) {
902 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
903 Builder.getIntN(VectorWidth, 0));
905 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
923 CondBlock->
setName(
"cond.load");
926 LoadInst *
Load = Builder.CreateAlignedLoad(EltTy, Ptr, AdjustedAlignment);
929 Value *NewVResult = Builder.CreateInsertElement(VResult,
Load, Idx);
933 if ((Idx + 1) != VectorWidth)
934 NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, 1);
940 IfBlock = NewIfBlock;
943 Builder.SetInsertPoint(NewIfBlock->
begin());
944 PHINode *ResultPhi = Builder.CreatePHI(VecType, 2,
"res.phi.else");
950 if ((Idx + 1) != VectorWidth) {
951 PHINode *PtrPhi = Builder.CreatePHI(Ptr->
getType(), 2,
"ptr.phi.else");
965 bool HasBranchDivergence,
CallInst *CI,
977 Builder.disableGEPCanonicalization();
980 Type *EltTy = VecType->getElementType();
983 const Align AdjustedAlignment =
986 unsigned VectorWidth = VecType->getNumElements();
990 unsigned MemIndex = 0;
991 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
992 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
995 Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
996 Value *NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, MemIndex);
998 Builder.CreateAlignedStore(OneElt, NewPtr, AdjustedAlignment);
1001 MemIndex *
DL.getTypeAllocSize(EltTy).getFixedValue());
1011 Value *SclrMask =
nullptr;
1012 if (VectorWidth != 1 && !HasBranchDivergence) {
1014 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
1017 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
1027 if (SclrMask !=
nullptr) {
1030 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
1031 Builder.getIntN(VectorWidth, 0));
1033 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
1051 CondBlock->
setName(
"cond.store");
1054 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
1056 Builder.CreateAlignedStore(OneElt, Ptr, AdjustedAlignment);
1062 if ((Idx + 1) != VectorWidth)
1063 NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, 1);
1069 IfBlock = NewIfBlock;
1071 Builder.SetInsertPoint(NewIfBlock->
begin());
1074 if ((Idx + 1) != VectorWidth) {
1075 PHINode *PtrPhi = Builder.CreatePHI(Ptr->
getType(), 2,
"ptr.phi.else");
1103 unsigned VectorWidth = AddrType->getNumElements();
1108 case Intrinsic::experimental_vector_histogram_add:
1109 UpdateOp = Builder.CreateAdd(
Load, Inc);
1111 case Intrinsic::experimental_vector_histogram_uadd_sat:
1113 Builder.CreateIntrinsic(Intrinsic::uadd_sat, {EltTy}, {
Load, Inc});
1115 case Intrinsic::experimental_vector_histogram_umin:
1116 UpdateOp = Builder.CreateIntrinsic(Intrinsic::umin, {EltTy}, {
Load, Inc});
1118 case Intrinsic::experimental_vector_histogram_umax:
1119 UpdateOp = Builder.CreateIntrinsic(Intrinsic::umax, {EltTy}, {
Load, Inc});
1130 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
1131 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
1133 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
1148 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
1150 Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
1161 CondBlock->
setName(
"cond.histogram.update");
1164 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
1178 Builder.SetInsertPoint(NewIfBlock->
begin());
1187 std::optional<DomTreeUpdater> DTU;
1189 DTU.emplace(DT, DomTreeUpdater::UpdateStrategy::Lazy);
1191 bool EverMadeChange =
false;
1192 bool MadeChange =
true;
1193 auto &
DL =
F.getDataLayout();
1194 bool HasBranchDivergence =
TTI.hasBranchDivergence(&
F);
1195 while (MadeChange) {
1198 bool ModifiedDTOnIteration =
false;
1200 HasBranchDivergence, DTU ? &*DTU :
nullptr);
1203 if (ModifiedDTOnIteration)
1207 EverMadeChange |= MadeChange;
1209 return EverMadeChange;
1212bool ScalarizeMaskedMemIntrinLegacyPass::runOnFunction(
Function &
F) {
1213 auto &
TTI = getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
F);
1214 DominatorTree *DT =
nullptr;
1215 if (
auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>())
1216 DT = &DTWP->getDomTree();
1235 bool MadeChange =
false;
1238 while (CurInstIterator != BB.
end()) {
1258 [](
Value *
V) { return isa<ScalableVectorType>(V->getType()); }))
1260 switch (
II->getIntrinsicID()) {
1263 case Intrinsic::experimental_vector_histogram_add:
1264 case Intrinsic::experimental_vector_histogram_uadd_sat:
1265 case Intrinsic::experimental_vector_histogram_umin:
1266 case Intrinsic::experimental_vector_histogram_umax:
1272 case Intrinsic::masked_load:
1274 if (
TTI.isLegalMaskedLoad(
1277 ->getAddressSpace(),
1284 case Intrinsic::masked_store:
1285 if (
TTI.isLegalMaskedStore(
1289 ->getAddressSpace(),
1296 case Intrinsic::masked_gather: {
1299 if (
TTI.isLegalMaskedGather(LoadTy, Alignment) &&
1305 case Intrinsic::masked_scatter: {
1308 if (
TTI.isLegalMaskedScatter(StoreTy, Alignment) &&
1315 case Intrinsic::masked_expandload:
1316 if (
TTI.isLegalMaskedExpandLoad(
1318 CI->
getAttributes().getParamAttrs(0).getAlignment().valueOrOne()))
1322 case Intrinsic::masked_compressstore:
1323 if (
TTI.isLegalMaskedCompressStore(
1325 CI->
getAttributes().getParamAttrs(1).getAlignment().valueOrOne()))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static bool runImpl(MachineFunction &MF)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool runOnFunction(Function &F, bool PostInlining)
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)
This file contains the declarations for profiling metadata utility functions.
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 void copyMemCacheHint(Instruction &Dest, const Instruction &Source, unsigned SourcePtrOperand, unsigned DestPtrOperand)
static void copyMetadataForScalarizedStore(StoreInst &Dest, const Instruction &Source, const DataLayout &DL, unsigned SourcePtrOperand, std::optional< size_t > ByteOffset)
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 copyMetadataForScalarizedLoad(LoadInst &Dest, const Instruction &Source, const DataLayout &DL, unsigned SourcePtrOperand, std::optional< size_t > ByteOffset)
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 void copyMetadataForMemoryAccess(Instruction &Dest, const Instruction &Source, const DataLayout &DL, unsigned SourcePtrOperand, unsigned DestPtrOperand, Type *AccessType, bool IsWholeAccess, std::optional< size_t > ByteOffset)
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; assumes that the block is well-formed.
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...
LLVM_ABI void setAAMetadata(const AAMDNodes &N)
Sets the AA metadata on this instruction from the AAMDNodes structure.
LLVM_ABI InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
LLVM_ABI const Function * getFunction() const
Return the function this instruction belongs to.
LLVM_ABI BasicBlock * getSuccessor(unsigned Idx) const LLVM_READONLY
Return the specified successor. This instruction must be a terminator.
LLVM_ABI void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
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.
static unsigned getPointerOperandIndex()
const MDOperand & getOperand(unsigned I) const
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
unsigned getNumOperands() const
Return number of MDNode operands.
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.
Value * getValueOperand()
static unsigned getPointerOperandIndex()
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.
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
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.
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.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)
Extract a Value from Metadata.
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.
@ Load
The value being inserted comes from a load (InsertElement only).
@ Store
The extracted value is stored (ExtractElement only).
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...
LLVM_ABI MDNode * getExplicitlyUnknownBranchWeightsIfProfiled(Function &F, StringRef PassName)
Returns a metadata node containing unknown branch weights if the function has an entry count,...
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.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
MDNode * TBAAStruct
The tag for type-based alias analysis (tbaa struct).
LLVM_ABI AAMDNodes adjustForAccess(unsigned AccessSize)
Create a new AAMDNode for accessing AccessSize bytes of this AAMDNode.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Align valueOrOne() const
For convenience, returns a valid alignment or 1 if undefined.
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)