LLVM: lib/Target/NVPTX/NVPTXTagInvariantLoads.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
27
28using namespace llvm;
29
31 const bool IsKernelFn) {
32
34 return false;
35
36
37 if (I->getMetadata(LLVMContext::MD_invariant_load))
38 return false;
39
40
41
42
43
46
49 return IsKernelFn && ((A->onlyReadsMemory() && A->hasNoAliasAttr()) ||
52 return GV->isConstant();
53 return false;
54 });
55}
56
58 I->setMetadata(LLVMContext::MD_invariant_load,
60}
61
64
68 if (isInvariantLoad(LI, LI->getPointerOperand(), IsKernelFn)) {
71 }
73 if (II->getIntrinsicID() == Intrinsic::masked_load &&
77 }
78 }
80}
81
82namespace {
83
84struct NVPTXTagInvariantLoadLegacyPass : public FunctionPass {
85 static char ID;
86
87 NVPTXTagInvariantLoadLegacyPass() : FunctionPass(ID) {}
89};
90
91}
92
93INITIALIZE_PASS(NVPTXTagInvariantLoadLegacyPass, "nvptx-tag-invariant-loads",
94 "NVPTX Tag Invariant Loads", false, false)
95
98}
99
100char NVPTXTagInvariantLoadLegacyPass::ID = 0;
101
103 return new NVPTXTagInvariantLoadLegacyPass();
104}
105
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)
Definition NVPTXTagInvariantLoads.cpp:62
static void markLoadsAsInvariant(Instruction *I)
Definition NVPTXTagInvariantLoads.cpp:57
static bool isInvariantLoad(const Instruction *I, const Value *Ptr, const bool IsKernelFn)
Definition NVPTXTagInvariantLoads.cpp:30
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 - Return the argument parameter cast to the specified type.
FunctionPass * createNVPTXTagInvariantLoadsPass()
Definition NVPTXTagInvariantLoads.cpp:102
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)
Definition NVPTXTagInvariantLoads.cpp:106