[PATCH] D105511: [AMDGPU] Add infer address spaces pass before atomic expand

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 6 13:38:37 PDT 2021


rampitec created this revision.
rampitec added reviewers: yaxunl, arsenm.
Herald added subscribers: foad, kerbowa, jfb, hiraditya, t-tye, tpr, dstuttard, nhaehnle, jvesely, kzhuravl.
rampitec requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

There are cases where infer address spaces pass cannot yet
infer an address space in the opt pipeline and then in the
llc pipeline it runs too late for atomic expand pass to
benefit from a specific address space.

Add yet anoter instance of infer address spaces just before
atomic expand at -O3 only.


https://reviews.llvm.org/D105511

Files:
  llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  llvm/test/CodeGen/AMDGPU/llc-pipeline.ll


Index: llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
+++ llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
@@ -995,6 +995,7 @@
 ; GCN-O3-NEXT:     Fix function bitcasts for AMDGPU
 ; GCN-O3-NEXT:     FunctionPass Manager
 ; GCN-O3-NEXT:       Early propagate attributes from kernels to functions
+; GCN-O3-NEXT:       Infer address spaces
 ; GCN-O3-NEXT:       Expand Atomic instructions
 ; GCN-O3-NEXT:     AMDGPU Lower Intrinsics
 ; GCN-O3-NEXT:     AMDGPU Inline All Functions
Index: llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -888,6 +888,9 @@
   // A call to propagate attributes pass in the backend in case opt was not run.
   addPass(createAMDGPUPropagateAttributesEarlyPass(&TM));
 
+  if (getOptLevel() == CodeGenOpt::Aggressive)
+    addPass(createInferAddressSpacesPass());
+
   addPass(createAtomicExpandPass());
 
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105511.356814.patch
Type: text/x-patch
Size: 1104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210706/e71a1ef3/attachment-0001.bin>


More information about the llvm-commits mailing list