44#define DEBUG_TYPE "scalarize-masked-mem-intrin"
48class ScalarizeMaskedMemIntrinLegacyPass :
public FunctionPass {
60 return "Scalarize Masked Memory Intrinsics";
79char ScalarizeMaskedMemIntrinLegacyPass::ID = 0;
82 "Scalarize unsupported masked memory intrinsics",
false,
87 "Scalarize unsupported masked memory intrinsics",
false,
91 return new ScalarizeMaskedMemIntrinLegacyPass();
100 for (
unsigned i = 0; i != NumElts; ++i) {
101 Constant *CElt =
C->getAggregateElement(i);
111 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);
328 Type *EltTy = VecType->getElementType();
332 Builder.SetInsertPoint(InsertPt);
333 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
337 StoreInst *Store = Builder.CreateAlignedStore(Src, Ptr, AlignVal);
339 Store->copyMetadata(*CI);
345 const Align AdjustedAlignVal =
350 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
351 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
353 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
354 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, Idx);
355 Builder.CreateAlignedStore(OneElt, Gep, AdjustedAlignVal);
366 Mask->getName() +
".first");
371 CondBlock->
setName(
"cond.store");
374 StoreInst *Store = Builder.CreateAlignedStore(Src, Ptr, AlignVal);
376 Store->copyMetadata(*CI);
386 Value *SclrMask =
nullptr;
387 if (VectorWidth != 1 && !HasBranchDivergence) {
389 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
392 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
403 if (SclrMask !=
nullptr) {
406 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
407 Builder.getIntN(VectorWidth, 0));
409 Predicate = Builder.CreateExtractElement(Mask, Idx);
423 CondBlock->
setName(
"cond.store");
426 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
427 Value *Gep = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, Idx);
428 Builder.CreateAlignedStore(OneElt, Gep, AdjustedAlignVal);
434 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
471 bool HasBranchDivergence,
CallInst *CI,
478 Type *EltTy = VecType->getElementType();
483 Builder.SetInsertPoint(InsertPt);
486 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
489 Value *VResult = Src0;
490 unsigned VectorWidth = VecType->getNumElements();
494 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
495 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
497 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
499 Builder.CreateAlignedLoad(EltTy, Ptr, AlignVal,
"Load" +
Twine(Idx));
501 Builder.CreateInsertElement(VResult, Load, Idx,
"Res" +
Twine(Idx));
511 Value *SclrMask =
nullptr;
512 if (VectorWidth != 1 && !HasBranchDivergence) {
514 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
517 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
529 if (SclrMask !=
nullptr) {
532 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
533 Builder.getIntN(VectorWidth, 0));
535 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
553 CondBlock->
setName(
"cond.load");
556 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
558 Builder.CreateAlignedLoad(EltTy, Ptr, AlignVal,
"Load" +
Twine(Idx));
560 Builder.CreateInsertElement(VResult, Load, Idx,
"Res" +
Twine(Idx));
566 IfBlock = NewIfBlock;
569 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
570 PHINode *Phi = Builder.CreatePHI(VecType, 2,
"res.phi.else");
571 Phi->addIncoming(NewVResult, CondBlock);
572 Phi->addIncoming(VResult, PrevIfBlock);
609 bool HasBranchDivergence,
CallInst *CI,
620 "Vector of pointers is expected in masked scatter intrinsic");
624 Builder.SetInsertPoint(InsertPt);
625 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
628 unsigned VectorWidth = SrcFVTy->getNumElements();
632 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
633 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
636 Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
637 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
638 Builder.CreateAlignedStore(OneElt, Ptr, AlignVal);
646 Value *SclrMask =
nullptr;
647 if (VectorWidth != 1 && !HasBranchDivergence) {
649 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
652 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
663 if (SclrMask !=
nullptr) {
666 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
667 Builder.getIntN(VectorWidth, 0));
669 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
687 CondBlock->
setName(
"cond.store");
690 Value *OneElt = Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
691 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
692 Builder.CreateAlignedStore(OneElt, Ptr, AlignVal);
698 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
706 bool HasBranchDivergence,
CallInst *CI,
715 Type *EltTy = VecType->getElementType();
721 Builder.SetInsertPoint(InsertPt);
722 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
724 unsigned VectorWidth = VecType->getNumElements();
727 Value *VResult = PassThru;
730 const Align AdjustedAlignment =
737 unsigned MemIndex = 0;
740 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
742 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue()) {
744 ShuffleMask[Idx] = Idx + VectorWidth;
747 Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, MemIndex);
748 InsertElt = Builder.CreateAlignedLoad(EltTy, NewPtr, AdjustedAlignment,
749 "Load" +
Twine(Idx));
750 ShuffleMask[Idx] = Idx;
753 VResult = Builder.CreateInsertElement(VResult, InsertElt, Idx,
756 VResult = Builder.CreateShuffleVector(VResult, PassThru, ShuffleMask);
765 Value *SclrMask =
nullptr;
766 if (VectorWidth != 1 && !HasBranchDivergence) {
768 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
771 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
783 if (SclrMask !=
nullptr) {
786 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
787 Builder.getIntN(VectorWidth, 0));
789 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
803 CondBlock->
setName(
"cond.load");
806 LoadInst *Load = Builder.CreateAlignedLoad(EltTy, Ptr, AdjustedAlignment);
807 Value *NewVResult = Builder.CreateInsertElement(VResult, Load, Idx);
811 if ((Idx + 1) != VectorWidth)
812 NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, 1);
818 IfBlock = NewIfBlock;
821 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
822 PHINode *ResultPhi = Builder.CreatePHI(VecType, 2,
"res.phi.else");
828 if ((Idx + 1) != VectorWidth) {
829 PHINode *PtrPhi = Builder.CreatePHI(Ptr->
getType(), 2,
"ptr.phi.else");
843 bool HasBranchDivergence,
CallInst *CI,
857 Builder.SetInsertPoint(InsertPt);
858 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
860 Type *EltTy = VecType->getElementType();
863 const Align AdjustedAlignment =
866 unsigned VectorWidth = VecType->getNumElements();
870 unsigned MemIndex = 0;
871 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
872 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
875 Builder.CreateExtractElement(Src, Idx,
"Elt" +
Twine(Idx));
876 Value *NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, MemIndex);
877 Builder.CreateAlignedStore(OneElt, NewPtr, AdjustedAlignment);
887 Value *SclrMask =
nullptr;
888 if (VectorWidth != 1 && !HasBranchDivergence) {
890 SclrMask = Builder.CreateBitCast(Mask, SclrMaskTy,
"scalar_mask");
893 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
903 if (SclrMask !=
nullptr) {
906 Predicate = Builder.CreateICmpNE(Builder.CreateAnd(SclrMask, Mask),
907 Builder.getIntN(VectorWidth, 0));
909 Predicate = Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
923 CondBlock->
setName(
"cond.store");
926 Value *OneElt = Builder.CreateExtractElement(Src, Idx);
927 Builder.CreateAlignedStore(OneElt, Ptr, AdjustedAlignment);
931 if ((Idx + 1) != VectorWidth)
932 NewPtr = Builder.CreateConstInBoundsGEP1_32(EltTy, Ptr, 1);
938 IfBlock = NewIfBlock;
940 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
943 if ((Idx + 1) != VectorWidth) {
944 PHINode *PtrPhi = Builder.CreatePHI(Ptr->
getType(), 2,
"ptr.phi.else");
970 Builder.SetInsertPoint(InsertPt);
972 Builder.SetCurrentDebugLocation(CI->
getDebugLoc());
975 unsigned VectorWidth = AddrType->getNumElements();
980 case Intrinsic::experimental_vector_histogram_add:
981 UpdateOp = Builder.CreateAdd(Load, Inc);
983 case Intrinsic::experimental_vector_histogram_uadd_sat:
985 Builder.CreateIntrinsic(Intrinsic::uadd_sat, {EltTy}, {Load, Inc});
987 case Intrinsic::experimental_vector_histogram_umin:
988 UpdateOp = Builder.CreateIntrinsic(Intrinsic::umin, {EltTy}, {Load, Inc});
990 case Intrinsic::experimental_vector_histogram_umax:
991 UpdateOp = Builder.CreateIntrinsic(Intrinsic::umax, {EltTy}, {Load, Inc});
1002 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
1003 if (
cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue())
1005 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
1006 LoadInst *Load = Builder.CreateLoad(EltTy, Ptr,
"Load" +
Twine(Idx));
1009 Builder.CreateStore(Update, Ptr);
1015 for (
unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
1017 Builder.CreateExtractElement(Mask, Idx,
"Mask" +
Twine(Idx));
1024 CondBlock->
setName(
"cond.histogram.update");
1027 Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx,
"Ptr" +
Twine(Idx));
1028 LoadInst *Load = Builder.CreateLoad(EltTy, Ptr,
"Load" +
Twine(Idx));
1031 Builder.CreateStore(UpdateOp, Ptr);
1036 Builder.SetInsertPoint(NewIfBlock, NewIfBlock->
begin());
1045 std::optional<DomTreeUpdater> DTU;
1047 DTU.emplace(DT, DomTreeUpdater::UpdateStrategy::Lazy);
1049 bool EverMadeChange =
false;
1050 bool MadeChange =
true;
1051 auto &
DL =
F.getDataLayout();
1052 bool HasBranchDivergence =
TTI.hasBranchDivergence(&
F);
1053 while (MadeChange) {
1056 bool ModifiedDTOnIteration =
false;
1058 HasBranchDivergence, DTU ? &*DTU :
nullptr);
1061 if (ModifiedDTOnIteration)
1065 EverMadeChange |= MadeChange;
1067 return EverMadeChange;
1070bool ScalarizeMaskedMemIntrinLegacyPass::runOnFunction(
Function &
F) {
1071 auto &
TTI = getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
F);
1072 DominatorTree *DT =
nullptr;
1073 if (
auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>())
1074 DT = &DTWP->getDomTree();
1093 bool MadeChange =
false;
1096 while (CurInstIterator != BB.
end()) {
1116 [](
Value *V) { return isa<ScalableVectorType>(V->getType()); }))
1118 switch (
II->getIntrinsicID()) {
1121 case Intrinsic::experimental_vector_histogram_add:
1122 case Intrinsic::experimental_vector_histogram_uadd_sat:
1123 case Intrinsic::experimental_vector_histogram_umin:
1124 case Intrinsic::experimental_vector_histogram_umax:
1130 case Intrinsic::masked_load:
1132 if (
TTI.isLegalMaskedLoad(
1135 ->getAddressSpace(),
1142 case Intrinsic::masked_store:
1143 if (
TTI.isLegalMaskedStore(
1147 ->getAddressSpace(),
1154 case Intrinsic::masked_gather: {
1157 if (
TTI.isLegalMaskedGather(LoadTy, Alignment) &&
1163 case Intrinsic::masked_scatter: {
1166 if (
TTI.isLegalMaskedScatter(StoreTy, Alignment) &&
1173 case Intrinsic::masked_expandload:
1174 if (
TTI.isLegalMaskedExpandLoad(
1176 CI->
getAttributes().getParamAttrs(0).getAlignment().valueOrOne()))
1180 case Intrinsic::masked_compressstore:
1181 if (
TTI.isLegalMaskedCompressStore(
1183 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, const LibcallLoweringInfo &Libcalls, 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)
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 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 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.
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.
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.
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...
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.
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.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)