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

nikola_ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 21:33:47 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, mgorny, 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/D86831

Files:
  llvm/CMakeLists.txt
  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)
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -323,7 +323,7 @@
   CACHE STRING "Semicolon-separated list of experimental targets to build.")
 
 option(BUILD_SHARED_LIBS
-  "Build all libraries as shared libraries instead of static" OFF)
+  "Build all libraries as shared libraries instead of static" ON)
 
 option(LLVM_ENABLE_BACKTRACES "Enable embedding backtraces on crash." ON)
 if(LLVM_ENABLE_BACKTRACES)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86831.288757.patch
Type: text/x-patch
Size: 1068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200829/7a84d974/attachment.bin>


More information about the llvm-commits mailing list