24#define DEBUG_TYPE "amdgpu-annotate-uniform"
30class AMDGPUAnnotateUniformValues
39 I->setMetadata(
"amdgpu.uniform",
MDNode::get(
I->getContext(), {}));
44 I->setMetadata(
"amdgpu.noclobber",
MDNode::get(
I->getContext(), {}));
51 : UA(&UA), MSSA(&MSSA), AA(&AA),
57 bool changed()
const {
return Changed; }
62void AMDGPUAnnotateUniformValues::visitBranchInst(
BranchInst &
I) {
63 if (UA->isUniform(&
I))
64 setUniformMetadata(&
I);
67void AMDGPUAnnotateUniformValues::visitLoadInst(
LoadInst &
I) {
69 if (!UA->isUniform(
Ptr))
73 setUniformMetadata(PtrI);
82 setNoClobberMetadata(&
I);
92 AMDGPUAnnotateUniformValues Impl(UI, MSSA, AA,
F);
114 return "AMDGPU Annotate Uniform Values";
130 getAnalysis<UniformityInfoWrapperPass>().getUniformityInfo();
131 MemorySSA &MSSA = getAnalysis<MemorySSAWrapperPass>().getMSSA();
132 AliasAnalysis &AA = getAnalysis<AAResultsWrapperPass>().getAAResults();
134 AMDGPUAnnotateUniformValues Impl(UI, MSSA, AA,
F);
136 return Impl.changed();
140 "Add AMDGPU uniform metadata",
false,
false)
static bool runOnFunction(Function &F, bool PostInlining)
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
FunctionAnalysisManager FAM
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
A manager for alias analyses.
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object.
A container for analyses that lazily runs them and caches their results.
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()
void setPreservesAll()
Set by analyses that do not transform their input at all.
Conditional or Unconditional Branch instruction.
Represents analyses that only rely on functions' control flow.
FunctionPass class - This class is used to implement most global optimizations.
Base class for instruction visitors.
RetTy visitBranchInst(BranchInst &I)
RetTy visitLoadInst(LoadInst &I)
An instruction for reading from memory.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
An analysis that produces MemorySSA for a function.
Legacy analysis pass which computes MemorySSA.
Encapsulates MemorySSA, including all data associated with memory accesses.
A Module instance is used to store all the information related to an LLVM module.
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.
void preserveSet()
Mark an analysis set as preserved.
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
@ GLOBAL_ADDRESS
Address space for global memory (RAT0, VTX0).
bool isEntryFunctionCC(CallingConv::ID CC)
bool isClobberedInFunction(const LoadInst *Load, MemorySSA *MSSA, AAResults *AA)
Check is a Load is clobbered in its function.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createAMDGPUAnnotateUniformValuesLegacy()
T uniform(GenT &Gen, T Min, T Max)
Return a uniformly distributed random value between Min and Max.