[llvm] [AMDGPU] Save/Restore SCC bit across waterfall loop. (PR #68363)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 05:07:42 PDT 2023
================
@@ -6079,6 +6079,17 @@ loadMBUFScalarOperandsFromVGPR(const SIInstrInfo &TII, MachineInstr &MI,
unsigned MovExecOpc = ST.isWave32() ? AMDGPU::S_MOV_B32 : AMDGPU::S_MOV_B64;
const auto *BoolXExecRC = TRI->getRegClass(AMDGPU::SReg_1_XEXECRegClassID);
+ // Save SCC. Waterfall Loop may overwrite SCC.
+ Register SaveSCCReg;
+ bool SCCNotDead = (MBB.computeRegisterLiveness(TRI, AMDGPU::SCC, MI, 30) !=
+ MachineBasicBlock::LQR_Dead);
+ if (SCCNotDead) {
----------------
jayfoad wrote:
Nits: call this `SCCLive`? Even better, rewrite so you don't need it:
```suggestion
Register SaveSCCReg;
if (MBB.computeRegisterLiveness(TRI, AMDGPU::SCC, MI, 30) !=
MachineBasicBlock::LQR_Dead) {
```
Then below you can just test:
```
// Restore SCC.
if (SaveSCCReg) ...
```
https://github.com/llvm/llvm-project/pull/68363
More information about the llvm-commits
mailing list