[llvm] [AMDGPU] Don't merge M0 initializations across calls that clobber M0 (PR #221963)

Pankaj Dwivedi via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 11 03:41:33 PDT 2026


================
@@ -609,7 +615,7 @@ static bool hoistAndMergeSGPRInits(unsigned Reg,
       const unsigned Threshold = 50;
       // Search until B or Threshold for a place to insert the initialization.
       for (unsigned I = 0; R != B && I < Threshold; ++R, ++I)
-        if (R->readsRegister(Reg, TRI) || R->definesRegister(Reg, TRI) ||
+        if (R->readsRegister(Reg, TRI) || R->modifiesRegister(Reg, TRI) ||
----------------
PankajDwivedi-25 wrote:

By the time we reach here the other init has been already removed, all we are doing here is positioning the other init.

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


More information about the llvm-commits mailing list