24#define DEBUG_TYPE "amdgpu-annotate-uniform"
39 I->setMetadata(
"amdgpu.uniform",
MDNode::get(
I->getContext(), {}));
44 I->setMetadata(
"amdgpu.noclobber",
MDNode::get(
I->getContext(), {}));
50 AMDGPUAnnotateUniformValues() :
55 return "AMDGPU Annotate Uniform Values";
71 "Add AMDGPU uniform metadata",
false,
false)
78char AMDGPUAnnotateUniformValues::
ID = 0;
80void AMDGPUAnnotateUniformValues::visitBranchInst(
BranchInst &
I) {
81 if (UA->isUniform(&
I))
82 setUniformMetadata(&
I);
85void AMDGPUAnnotateUniformValues::visitLoadInst(
LoadInst &
I) {
87 if (!UA->isUniform(
Ptr))
91 setUniformMetadata(PtrI);
99 if (GlobalLoad && !AMDGPU::isClobberedInFunction(&
I, MSSA, AA))
100 setNoClobberMetadata(&
I);
103bool AMDGPUAnnotateUniformValues::doInitialization(
Module &M) {
107bool AMDGPUAnnotateUniformValues::runOnFunction(
Function &
F) {
111 UA = &getAnalysis<UniformityInfoWrapperPass>().getUniformityInfo();
112 MSSA = &getAnalysis<MemorySSAWrapperPass>().getMSSA();
113 AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
114 isEntryFunc = AMDGPU::isEntryFunctionCC(
F.getCallingConv());
123 return new AMDGPUAnnotateUniformValues();
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object.
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.
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.
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)
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.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
virtual bool doInitialization(Module &)
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
@ GLOBAL_ADDRESS
Address space for global memory (RAT0, VTX0).
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createAMDGPUAnnotateUniformValues()
T uniform(GenT &Gen, T Min, T Max)
Return a uniformly distributed random value between Min and Max.