[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:57:35 PDT 2026


================
@@ -637,12 +643,18 @@ bool SIFixSGPRCopies::run(MachineFunction &MF) {
 
   // Instructions to re-legalize after changing register classes
   SmallVector<MachineInstr *, 8> Relegalize;
+  SmallVector<MachineInstr *, 4> Calls;
 
   for (MachineBasicBlock &MBB : MF) {
     for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end(); I != E;
          ++I) {
       MachineInstr &MI = *I;
 
+      // Record calls while walking the function so that hoistAndMergeSGPRInits
+      // can find the registers they clobber through their regmask operand.
----------------
PankajDwivedi-25 wrote:

better I keep track of regmask, it would capture calls as well?

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


More information about the llvm-commits mailing list