31 const bool IsKernelFn) {
37 if (
I->getMetadata(LLVMContext::MD_invariant_load))
49 return IsKernelFn && ((
A->onlyReadsMemory() &&
A->hasNoAliasAttr()) ||
52 return GV->isConstant();
58 I->setMetadata(LLVMContext::MD_invariant_load,
73 if (
II->getIntrinsicID() == Intrinsic::masked_load &&
84struct NVPTXTagInvariantLoadLegacyPass :
public FunctionPass {
87 NVPTXTagInvariantLoadLegacyPass() : FunctionPass(ID) {}
94 "NVPTX Tag Invariant Loads",
false,
false)
100char NVPTXTagInvariantLoadLegacyPass::ID = 0;
103 return new NVPTXTagInvariantLoadLegacyPass();
Expand Atomic instructions
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static bool runOnFunction(Function &F, bool PostInlining)
NVPTX address space definition.
static bool tagInvariantLoads(Function &F)
static void markLoadsAsInvariant(Instruction *I)
static bool isInvariantLoad(const Instruction *I, const Value *Ptr, const bool IsKernelFn)
uint64_t IntrinsicInst * II
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
FunctionPass class - This class is used to implement most global optimizations.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
FunctionPass * createNVPTXTagInvariantLoadsPass()
bool isParamGridConstant(const Argument &Arg)
bool isKernelFunction(const Function &F)
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
LLVM_ABI void getUnderlyingObjects(const Value *V, SmallVectorImpl< const Value * > &Objects, const LoopInfo *LI=nullptr, unsigned MaxLookup=MaxLookupSearchDepth)
This method is similar to getUnderlyingObject except that it can look through phi and select instruct...
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)