[llvm] [AMDGPU] Save and restore SCC using only 32-bit SGPR. (PR #68367)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 05:31:44 PDT 2023


================
@@ -6014,6 +6047,15 @@ 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 SCCDefined = false;
+  if ((SCCDefined = TII.isSCCDefinedAndUsed(MBB, Begin, End))) {
----------------
Pierre-vh wrote:

You don't need to assign inside the condition, just set `SCCDefined` directly.

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


More information about the llvm-commits mailing list