[llvm] [AMDGPU] add SROA before InferAddressSpace (PR #137909)

Gang Chen via llvm-commits llvm-commits at lists.llvm.org
Thu May 1 08:13:01 PDT 2025


================
@@ -861,8 +862,13 @@ void AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
             EnablePromoteKernelArguments)
           FPM.addPass(AMDGPUPromoteKernelArgumentsPass());
 
+        // Add SROA after inlining but before infer address spaces pass to
+        // unlock address space inference for smart pointers (pointers
+        // encapsulated in structs).
+        FPM.addPass(SROAPass(SROAOptions::PreserveCFG));
+
         // Add infer address spaces pass to the opt pipeline after inlining
-        // but before SROA to increase SROA opportunities.
+        // but before another SROA round to increase SROA opportunities.
----------------
cmc-rep wrote:

I think this runs after inlining. In our case, we see the need of SROA to eliminate load/store of pointer-value, to enable InferAddressSpace on those pointers.

https://github.com/llvm/llvm-project/pull/137909


More information about the llvm-commits mailing list