[llvm] [AMDGPU] Save/Restore SCC bit across waterfall loop. (PR #68363)

Carl Ritson via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 9 19:12:30 PDT 2023


================
@@ -5094,6 +5094,39 @@ unsigned SIInstrInfo::getVALUOp(const MachineInstr &MI) const {
       "Unexpected scalar opcode without corresponding vector one!");
 }
 
+bool SIInstrInfo::isSCCDefinedBefore(MachineBasicBlock &MBB,
----------------
perlfu wrote:

The reason for using computeRegisterLiveness is that handles edges case such as liveins/liveouts, bundles, etc.

We should just trust the dead flag here.  The case you are trying to capture should presumably already be handled by this?  A def before the waterfall without a use after it, should be dead. In any other scenario we should consider SCC to be live.

Preserving SCC if `computeRegisterLiveness(Reg) != LQR_DEAD` should be sufficient.  As computeRegisterLiveness will check the dead flags and check for clobbering during its forward search.

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


More information about the llvm-commits mailing list