diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp @@ -33,6 +33,17 @@ MemorySSA *MSSA; AliasAnalysis *AA; bool isEntryFunc; + bool Changed; + + void setUniformMetadata(Instruction *I) { + I->setMetadata("amdgpu.uniform", MDNode::get(I->getContext(), {})); + Changed = true; + } + + void setNoClobberMetadata(Instruction *I) { + I->setMetadata("amdgpu.noclobber", MDNode::get(I->getContext(), {})); + Changed = true; + } public: static char ID; @@ -66,13 +77,6 @@ char AMDGPUAnnotateUniformValues::ID = 0; -static void setUniformMetadata(Instruction *I) { - I->setMetadata("amdgpu.uniform", MDNode::get(I->getContext(), {})); -} -static void setNoClobberMetadata(Instruction *I) { - I->setMetadata("amdgpu.noclobber", MDNode::get(I->getContext(), {})); -} - void AMDGPUAnnotateUniformValues::visitBranchInst(BranchInst &I) { if (DA->isUniform(&I)) setUniformMetadata(&I); @@ -109,8 +113,9 @@ AA = &getAnalysis().getAAResults(); isEntryFunc = AMDGPU::isEntryFunctionCC(F.getCallingConv()); + Changed = false; visit(F); - return true; + return Changed; } FunctionPass *