[PATCH] D86833: [AMDGPU] AMDGPUAAResult::pointsToConstantMemory should not use the default MaxLookup (i.e., 6) to limit getUnderlyingObject

zhuoran ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 22:22:18 PDT 2020


jizhuoran created this revision.
jizhuoran added reviewers: alex-t, rampitec, vpykhtin, arsenm.
Herald added subscribers: llvm-commits, danielkiss, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: LLVM.
jizhuoran requested review of this revision.
Herald added a subscriber: wdng.

The default value of MaxLookup is 6, which limits the number of instructions to be stripped off when getting the underlying object. 'Loop Unroll' and 'Loop Strength Reduction' passes trend to replace the memory index 'base + i * offset' to 'base, base += offset, base += offset'. It increases the depth of the underlying object so that pointsToConstantMemory may fail to identify a pointer's underlying object is a NoAlias and ReadOnly Argument. It leads to false memory load scheduling dependency and prevents the instruction scheduler to pipeline the memory load operations.

The default MaxLookup is too small for this case. In general, even the first memory load has a GEP and a bitcast. The false memory dependency begins from the fifth memory load for a global memory (argument). It causes less efficient assembly codes.a

Specifying a larger MaxLookup value or even an unlimited MaxLookup (i.e., 0) solves this problem.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86833

Files:
  llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp


Index: llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
@@ -96,7 +96,7 @@
       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
     return true;
 
-  const Value *Base = getUnderlyingObject(Loc.Ptr);
+  const Value *Base = getUnderlyingObject(Loc.Ptr, 0);
   AS = Base->getType()->getPointerAddressSpace();
   if (AS == AMDGPUAS::CONSTANT_ADDRESS ||
       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86833.288760.patch
Type: text/x-patch
Size: 559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200829/acdb6f45/attachment.bin>


More information about the llvm-commits mailing list