[PATCH] D84873: AMDGPU: In determining load clobbering in AnnotateUniform, don't scan if there are too many blocks.

Changpeng Fang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 4 16:03:00 PDT 2020


cfang added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp:118-126
   for (auto &BB : Checklist) {
     BasicBlock::iterator StartIt = (!L && (BB == Load->getParent())) ?
       BasicBlock::iterator(Load) : BB->end();
     auto Q = MDR->getPointerDependencyFrom(MemoryLocation(Ptr), true,
                                            StartIt, BB, Load);
     if (Q.isClobber() || Q.isUnknown())
       return true;
----------------
arsenm wrote:
> This seems like a pretty stupid way of using this analysis. This is going to be re-scanning the same instructions many times. My quick look at MemoryDependenceAnalysis suggests the way you should use it is to use a combination of getDependency and getNonLocalPointeDependency, which has a cache and internally calls getPointerDependencyFrom. You would then have to walk up the chain of dependencies until you find no clobbers?
You are right. We need to come out with a better memory dependence analysis algorithm to avoid redundant searching. Before that, we should live with the current approach, which is a correct one. 
As a result, we have to restrict the search to control the compile time.  


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84873/new/

https://reviews.llvm.org/D84873



More information about the llvm-commits mailing list