46#define DEBUG_TYPE "scalarize-masked-mem-intrin"
50class ScalarizeMaskedMemIntrinLegacyPass :
public FunctionPass {
54 explicit ScalarizeMaskedMemIntrinLegacyPass() :
FunctionPass(ID) {
62 return "Scalarize Masked Memory Intrinsics";
81char ScalarizeMaskedMemIntrinLegacyPass::ID = 0;
84 "Scalarize unsupported masked memory intrinsics",
false,
89 "Scalarize unsupported masked memory intrinsics",
false,
93 return new ScalarizeMaskedMemIntrinLegacyPass();
102 for (
unsigned i = 0; i != NumElts; ++i) {
103 Constant *CElt =
C->getAggregateElement(i);
113 return DL.isBigEndian() ? VectorWidth - 1 - Idx : Idx;
118 unsigned SourcePtrOperand,
unsigned DestPtrOperand,
Type *AccessType,
119 bool IsWholeAccess, std::optional<size_t> ByteOffset) {
124 {LLVMContext::MD_nontemporal,
125 LLVMContext::MD_mem_parallel_loop_access,
126 LLVMContext::MD_access_group, LLVMContext::MD_annotation,
127 LLVMContext::MD_nosanitize, LLVMContext::MD_mmra});
129 AAMDNodes AANodes = Source.getAAMetadata();
147 unsigned SourcePtrOperand,
148 std::optional<size_t> ByteOffset) {
151 Dest.
getType() == Source.getType(), ByteOffset);
155 Dest.
copyMetadata(Source, {LLVMContext::MD_fpmath, LLVMContext::MD_range,
156 LLVMContext::MD_invariant_load});
162 unsigned SourcePtrOperand,
163 std::optional<size_t> ByteOffset) {
213 Type *EltTy = VecType->getElementType();
217 Builder.disableGEPCanonicalization();
222 LoadInst *NewI = Builder.CreateAlignedLoad(VecType, Ptr, AlignVal);
232 const Align AdjustedAlignVal =
237 Value *VResult = Src0;
240 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
241 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
243 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, Idx);
244 LoadInst *
Load = Builder.CreateAlignedLoad(EltTy, Gep, AdjustedAlignVal);
247 Idx *
DL.getTypeAllocSize(EltTy).getFixedValue());
248 VResult = Builder.CreateInsertElement(VResult,
Load, Idx);
260 Mask->getName() +
".first");
270 CondBlock->
setName(
"cond.load");
272 LoadInst *
Load = Builder.CreateAlignedLoad(VecType, Ptr, AlignVal,
278 Builder.SetInsertPoint(PostLoad->
begin());
279 PHINode *Phi = Builder.CreatePHI(VecType, 2);
280 Phi->addIncoming(
Load, CondBlock);
281 Phi->addIncoming(Src0, IfBlock);
292 Value *SclrMask =
nullptr;
293 if (VectorWidth != 1 && !HasBranchDivergence) {
295 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
298 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
309 if (SclrMask !=
nullptr) {
312 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
313 Builder.getIntN(VectorWidth, 0));
315 Predicate = Builder.CreateExtractElement(Mask, Idx);
333 CondBlock->
setName(
"cond.load");
336 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, Idx);
337 LoadInst *
Load = Builder.CreateAlignedLoad(EltTy, Gep, AdjustedAlignVal);
340 Idx *
DL.getTypeAllocSize(EltTy).getFixedValue());
341 Value *NewVResult = Builder.CreateInsertElement(VResult,
Load, Idx);
347 IfBlock = NewIfBlock;
350 Builder.SetInsertPoint(NewIfBlock->
begin());
351 PHINode *Phi = Builder.CreatePHI(VecType, 2,
"res.phi.else");
352 Phi->addIncoming(NewVResult, CondBlock);
353 Phi->addIncoming(VResult, PrevIfBlock);
399 Type *EltTy = VecType->getElementType();
403 Builder.disableGEPCanonicalization();
407 StoreInst *
Store = Builder.CreateAlignedStore(Src, Ptr, AlignVal);
412 Store->copyMetadata(*CI, LLVMContext::MD_DIAssignID);
418 const Align AdjustedAlignVal =
423 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
424 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
426 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
427 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, Idx);
429 Builder.CreateAlignedStore(OneElt, Gep, AdjustedAlignVal);
432 Idx *
DL.getTypeAllocSize(EltTy).getFixedValue());
443 Mask->getName() +
".first");
452 CondBlock->
setName(
"cond.store");
455 StoreInst *
Store = Builder.CreateAlignedStore(Src, Ptr, AlignVal);
460 Store->copyMetadata(*CI, LLVMContext::MD_DIAssignID);
470 Value *SclrMask =
nullptr;
471 if (VectorWidth != 1 && !HasBranchDivergence) {
473 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
476 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
487 if (SclrMask !=
nullptr) {
490 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
491 Builder.getIntN(VectorWidth, 0));
493 Predicate = Builder.CreateExtractElement(Mask, Idx);
511 CondBlock->
setName(
"cond.store");
514 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
515 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, Idx);
517 Builder.CreateAlignedStore(OneElt, Gep, AdjustedAlignVal);
520 Idx *
DL.getTypeAllocSize(EltTy).getFixedValue());
526 Builder.SetInsertPoint(NewIfBlock->
begin());
563 bool HasBranchDivergence,
CallInst *CI,
570 Type *EltTy = VecType->getElementType();
578 Value *VResult = Src0;
579 unsigned VectorWidth = VecType->getNumElements();
583 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
584 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
586 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
588 Builder.CreateAlignedLoad(EltTy, Ptr, AlignVal,
"Load" +
Twine(Idx));
592 Builder.CreateInsertElement(VResult,
Load, Idx,
"Res" +
Twine(Idx));
602 Value *SclrMask =
nullptr;
603 if (VectorWidth != 1 && !HasBranchDivergence) {
605 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
608 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
620 if (SclrMask !=
nullptr) {
623 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
624 Builder.getIntN(VectorWidth, 0));
626 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
644 CondBlock->
setName(
"cond.load");
647 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
649 Builder.CreateAlignedLoad(EltTy, Ptr, AlignVal,
"Load" +
Twine(Idx));
653 Builder.CreateInsertElement(VResult,
Load, Idx,
"Res" +
Twine(Idx));
659 IfBlock = NewIfBlock;
662 Builder.SetInsertPoint(NewIfBlock->
begin());
663 PHINode *Phi = Builder.CreatePHI(VecType, 2,
"res.phi.else");
664 Phi->addIncoming(NewVResult, CondBlock);
665 Phi->addIncoming(VResult, PrevIfBlock);
702 bool HasBranchDivergence,
CallInst *CI,
713 "Vector of pointers is expected in masked scatter intrinsic");
719 unsigned VectorWidth = SrcFVTy->getNumElements();
723 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
724 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
727 Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
728 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
729 StoreInst *
Store = Builder.CreateAlignedStore(OneElt, Ptr, AlignVal);
740 Value *SclrMask =
nullptr;
741 if (VectorWidth != 1 && !HasBranchDivergence) {
743 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
746 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
757 if (SclrMask !=
nullptr) {
760 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
761 Builder.getIntN(VectorWidth, 0));
763 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
781 CondBlock->
setName(
"cond.store");
784 Value *OneElt = Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
785 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
786 StoreInst *
Store = Builder.CreateAlignedStore(OneElt, Ptr, AlignVal);
795 Builder.SetInsertPoint(NewIfBlock->
begin());
803 bool HasBranchDivergence,
CallInst *CI,
812 Type *EltTy = VecType->getElementType();
816 Builder.disableGEPCanonicalization();
819 unsigned VectorWidth = VecType->getNumElements();
822 Value *VResult = PassThru;
825 const Align AdjustedAlignment =
832 unsigned MemIndex = 0;
835 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
837 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue()) {
839 ShuffleMask[Idx] = Idx + VectorWidth;
842 Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, MemIndex);
844 EltTy, NewPtr, AdjustedAlignment,
"Load" +
Twine(Idx));
847 MemIndex *
DL.getTypeAllocSize(EltTy).getFixedValue());
849 ShuffleMask[Idx] = Idx;
852 VResult = Builder.CreateInsertElement(VResult, InsertElt, Idx,
855 VResult = Builder.CreateShuffleVector(VResult, PassThru, ShuffleMask);
864 Value *SclrMask =
nullptr;
865 if (VectorWidth != 1 && !HasBranchDivergence) {
867 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
870 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
882 if (SclrMask !=
nullptr) {
885 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
886 Builder.getIntN(VectorWidth, 0));
888 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
906 CondBlock->
setName(
"cond.load");
909 LoadInst *
Load = Builder.CreateAlignedLoad(EltTy, Ptr, AdjustedAlignment);
912 Value *NewVResult = Builder.CreateInsertElement(VResult,
Load, Idx);
916 if ((Idx + 1) != VectorWidth)
917 NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, 1);
923 IfBlock = NewIfBlock;
926 Builder.SetInsertPoint(NewIfBlock->
begin());
927 PHINode *ResultPhi = Builder.CreatePHI(VecType, 2,
"res.phi.else");
933 if ((Idx + 1) != VectorWidth) {
934 PHINode *PtrPhi = Builder.CreatePHI(Ptr->
getType(), 2,
"ptr.phi.else");
948 bool HasBranchDivergence,
CallInst *CI,
960 Builder.disableGEPCanonicalization();
963 Type *EltTy = VecType->getElementType();
966 const Align AdjustedAlignment =
969 unsigned VectorWidth = VecType->getNumElements();
973 unsigned MemIndex = 0;
974 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
975 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
978 Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
979 Value *NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, MemIndex);
981 Builder.CreateAlignedStore(OneElt, NewPtr, AdjustedAlignment);
984 MemIndex *
DL.getTypeAllocSize(EltTy).getFixedValue());
994 Value *SclrMask =
nullptr;
995 if (VectorWidth != 1 && !HasBranchDivergence) {
997 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
1000 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
1010 if (SclrMask !=
nullptr) {
1013 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
1014 Builder.getIntN(VectorWidth, 0));
1016 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
1034 CondBlock->
setName(
"cond.store");
1037 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
1039 Builder.CreateAlignedStore(OneElt, Ptr, AdjustedAlignment);
1045 if ((Idx + 1) != VectorWidth)
1046 NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, 1);
1052 IfBlock = NewIfBlock;
1054 Builder.SetInsertPoint(NewIfBlock->
begin());
1057 if ((Idx + 1) != VectorWidth) {
1058 PHINode *PtrPhi = Builder.CreatePHI(Ptr->
getType(), 2,
"ptr.phi.else");
1086 unsigned VectorWidth = AddrType->getNumElements();
1091 case Intrinsic::experimental_vector_histogram_add:
1092 UpdateOp = Builder.CreateAdd(
Load, Inc);
1094 case Intrinsic::experimental_vector_histogram_uadd_sat:
1096 Builder.CreateIntrinsic(Intrinsic::uadd_sat, {EltTy}, {
Load, Inc});
1098 case Intrinsic::experimental_vector_histogram_umin:
1099 UpdateOp = Builder.CreateIntrinsic(Intrinsic::umin, {EltTy}, {
Load, Inc});
1101 case Intrinsic::experimental_vector_histogram_umax:
1102 UpdateOp = Builder.CreateIntrinsic(Intrinsic::umax, {EltTy}, {
Load, Inc});
1113 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
1114 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
1116 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
1131 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
1133 Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
1144 CondBlock->
setName(
"cond.histogram.update");
1147 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
1161 Builder.SetInsertPoint(NewIfBlock->
begin());
1170 std::optional<DomTreeUpdater> DTU;
1172 DTU.emplace(DT, DomTreeUpdater::UpdateStrategy::Lazy);
1174 bool EverMadeChange =
false;
1175 bool MadeChange =
true;
1176 auto &
DL =
F.getDataLayout();
1177 bool HasBranchDivergence =
TTI.hasBranchDivergence(&
F);
1178 while (MadeChange) {
1181 bool ModifiedDTOnIteration =
false;
1183 HasBranchDivergence, DTU ? &*DTU :
nullptr);
1186 if (ModifiedDTOnIteration)
1190 EverMadeChange |= MadeChange;
1192 return EverMadeChange;
1195bool ScalarizeMaskedMemIntrinLegacyPass::runOnFunction(
Function &
F) {
1196 auto &
TTI = getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
F);
1197 DominatorTree *DT =
nullptr;
1198 if (
auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>())
1199 DT = &DTWP->getDomTree();
1218 bool MadeChange =
false;
1221 while (CurInstIterator != BB.
end()) {
1241 [](
Value *
V) { return isa<ScalableVectorType>(V->getType()); }))
1243 switch (
II->getIntrinsicID()) {
1246 case Intrinsic::experimental_vector_histogram_add:
1247 case Intrinsic::experimental_vector_histogram_uadd_sat:
1248 case Intrinsic::experimental_vector_histogram_umin:
1249 case Intrinsic::experimental_vector_histogram_umax:
1255 case Intrinsic::masked_load:
1257 if (
TTI.isLegalMaskedLoad(
1260 ->getAddressSpace(),
1267 case Intrinsic::masked_store:
1268 if (
TTI.isLegalMaskedStore(
1272 ->getAddressSpace(),
1279 case Intrinsic::masked_gather: {
1282 if (
TTI.isLegalMaskedGather(LoadTy, Alignment) &&
1288 case Intrinsic::masked_scatter: {
1291 if (
TTI.isLegalMaskedScatter(StoreTy, Alignment) &&
1298 case Intrinsic::masked_expandload:
1299 if (
TTI.isLegalMaskedExpandLoad(
1301 CI->
getAttributes().getParamAttrs(0).getAlignment().valueOrOne()))
1305 case Intrinsic::masked_compressstore:
1306 if (
TTI.isLegalMaskedCompressStore(
1308 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 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 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()
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.
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 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.
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.
LLVM_ABI void setMemCacheHint(Instruction &I, unsigned OperandNo, MDNode *Hint)
Set the hint payload for operand OperandNo of I, preserving other operands' hints.
@ 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 MDNode * getMemCacheHint(const Instruction &I, unsigned OperandNo=0)
Return the hint payload for operand OperandNo of I, or nullptr if absent.
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)