[llvm] [AMDGPU] Make LowerModuleLDS a noop on an already lowered module (PR #217075)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 08:00:22 PDT 2026


================
@@ -1078,13 +1078,16 @@ class AMDGPULowerModuleLDS {
   }
 
   bool runOnModuleNormal(Module &M) {
-    CallGraph CG = CallGraph(M);
-    bool Changed = superAlignLDSGlobals(M);
+    // Nothing left to lower on the codegen-partition rerun.
+    if (none_of(M.globals(), isNotYetLoweredLDSVariable))
+      return false;
 
-    Changed |=
-        eliminateGVConstantExprUsesFromAllInstructions(M, isLDSVariableToLower);
+    superAlignLDSGlobals(M);
----------------
shiltian wrote:

I think if we properly check each LDS variable in `superAlignLDSGlobals` and `eliminateGVConstantExprUsesFromAllInstructions`, we don't need the check at the beginning.

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


More information about the llvm-commits mailing list