36 if (LI->
getMetadata(LLVMContext::MD_invariant_load))
47 if (
const auto *
A = dyn_cast<const Argument>(V))
48 return IsKernelFn && ((
A->onlyReadsMemory() &&
A->hasNoAliasAttr()) ||
50 if (
const auto *GV = dyn_cast<const GlobalVariable>(V))
51 return GV->isConstant();
66 if (
auto *LI = dyn_cast<LoadInst>(&
I)) {
78struct NVPTXTagInvariantLoadLegacyPass :
public FunctionPass {
88 "NVPTX Tag Invariant Loads",
false,
false)
94char NVPTXTagInvariantLoadLegacyPass::ID = 0;
97 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 void markLoadsAsInvariant(LoadInst *LI)
static bool tagInvariantLoads(Function &F)
static bool isInvariantLoad(const LoadInst *LI, const bool IsKernelFn)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
A container for analyses that lazily runs them and caches their results.
FunctionPass class - This class is used to implement most global optimizations.
virtual bool runOnFunction(Function &F)=0
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
LLVM_ABI void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
An instruction for reading from memory.
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
Value * getPointerOperand()
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 Value Representation.
LLVM_ABI LLVMContext & getContext() const
All values hold a context through their type.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
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.
FunctionPass * createNVPTXTagInvariantLoadsPass()
bool isParamGridConstant(const Argument &Arg)
bool isKernelFunction(const Function &F)
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)