Skip to content

Commit 68bca17

Browse files
authored
[AMDGPU] SILowerControlFlow: ensure EXEC/SCC interval recompute (#160459)
Ensure live intervals for EXEC and SCC are removed on all paths which generate instructions.
1 parent 2a0d7f8 commit 68bca17

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ void SILowerControlFlow::emitIf(MachineInstr &MI) {
293293
LIS->InsertMachineInstrInMaps(*SetExec);
294294
LIS->InsertMachineInstrInMaps(*NewBr);
295295

296-
LIS->removeAllRegUnitsForPhysReg(AMDGPU::EXEC);
297296
MI.eraseFromParent();
298297

299298
// FIXME: Is there a better way of adjusting the liveness? It shouldn't be
@@ -363,9 +362,6 @@ void SILowerControlFlow::emitElse(MachineInstr &MI) {
363362
RecomputeRegs.insert(SrcReg);
364363
RecomputeRegs.insert(DstReg);
365364
LIS->createAndComputeVirtRegInterval(SaveReg);
366-
367-
// Let this be recomputed.
368-
LIS->removeAllRegUnitsForPhysReg(AMDGPU::EXEC);
369365
}
370366

371367
void SILowerControlFlow::emitIfBreak(MachineInstr &MI) {
@@ -828,7 +824,10 @@ bool SILowerControlFlow::run(MachineFunction &MF) {
828824

829825
optimizeEndCf();
830826

831-
if (LIS) {
827+
if (LIS && Changed) {
828+
// These will need to be recomputed for insertions and removals.
829+
LIS->removeAllRegUnitsForPhysReg(AMDGPU::EXEC);
830+
LIS->removeAllRegUnitsForPhysReg(AMDGPU::SCC);
832831
for (Register Reg : RecomputeRegs) {
833832
LIS->removeInterval(Reg);
834833
LIS->createAndComputeVirtRegInterval(Reg);

0 commit comments

Comments
 (0)