[llvm] [AMDGPU] Add mark last scratch load pass (PR #75512)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 04:47:50 PST 2024


================
@@ -2241,14 +2242,20 @@ bool SIRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator MI,
         TII->insertScratchExecCopy(*MF, *MBB, MI, DL, MFI->getSGPRForEXECCopy(),
                                   RS->isRegUsed(AMDGPU::SCC));
       }
+      int16_t LastUseIdx =
+          AMDGPU::getNamedOperandIdx(MI->getOpcode(), AMDGPU::OpName::last_use);
+      bool LastUse = (LastUseIdx != -1)
+                         ? (MI->getOperand(LastUseIdx).getImm() == 1)
+                         : false;
----------------
jayfoad wrote:

```suggestion
      bool LastUse = LastUseIdx != -1 && MI->getOperand(LastUseIdx).getImm() == 1;
```

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


More information about the llvm-commits mailing list