[llvm] [AMDGPU][Attributor] Rework update of `AAAMDWavesPerEU` (PR #123995)

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 15:43:27 PDT 2025


================
@@ -1396,8 +1425,16 @@ static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM,
     }
   }
 
-  ChangeStatus Change = A.run();
-  return Change == ChangeStatus::CHANGED;
+  bool Changed = A.run() == ChangeStatus::CHANGED;
+
+  // We only update the waves-per-eu attribute at the final stage to avoid
+  // setting it with intermediate values.
+  if (Changed && (LTOPhase == ThinOrFullLTOPhase::None ||
+                  LTOPhase == ThinOrFullLTOPhase::FullLTOPostLink ||
+                  LTOPhase == ThinOrFullLTOPhase::ThinLTOPostLink))
----------------
jdoerfert wrote:

This doesn't work. You can't not set it as later Changed might be false, and you never validate/fixup the result. I would suggest to ignore Changed and simply update the WavesPerEu.

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


More information about the llvm-commits mailing list