Skip to content

Commit 67b6fd0

Browse files
authored
AMDGPU: Delete redundant recursive copy handling code (llvm#157032)
This fixes a regression exposed after 4454152. This introduces a few small regressions for true16. There are more cases where the value can propagate through subregister extracts which need new handling. They're also small enough that perhaps there's a way to avoid needing to deal with this case in the first place.
1 parent 5321f5c commit 67b6fd0

File tree

4 files changed

+409
-240
lines changed

4 files changed

+409
-240
lines changed

llvm/lib/Target/AMDGPU/SIFoldOperands.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,40 +1129,11 @@ bool SIFoldOperandsImpl::tryToFoldACImm(
11291129
if (!AMDGPU::isSISrcOperand(Desc, UseOpIdx))
11301130
return false;
11311131

1132-
MachineOperand &UseOp = UseMI->getOperand(UseOpIdx);
11331132
if (OpToFold.isImm() && OpToFold.isOperandLegal(*TII, *UseMI, UseOpIdx)) {
11341133
appendFoldCandidate(FoldList, UseMI, UseOpIdx, OpToFold);
11351134
return true;
11361135
}
11371136

1138-
// TODO: Verify the following code handles subregisters correctly.
1139-
// TODO: Handle extract of global reference
1140-
if (UseOp.getSubReg())
1141-
return false;
1142-
1143-
if (!OpToFold.isReg())
1144-
return false;
1145-
1146-
Register UseReg = OpToFold.getReg();
1147-
if (!UseReg.isVirtual())
1148-
return false;
1149-
1150-
// Maybe it is just a COPY of an immediate itself.
1151-
1152-
// FIXME: Remove this handling. There is already special case folding of
1153-
// immediate into copy in foldOperand. This is looking for the def of the
1154-
// value the folding started from in the first place.
1155-
MachineInstr *Def = MRI->getVRegDef(UseReg);
1156-
if (Def && TII->isFoldableCopy(*Def)) {
1157-
MachineOperand &DefOp = Def->getOperand(1);
1158-
if (DefOp.isImm() && TII->isOperandLegal(*UseMI, UseOpIdx, &DefOp)) {
1159-
FoldableDef FoldableImm(DefOp.getImm(), OpToFold.DefRC,
1160-
OpToFold.DefSubReg);
1161-
appendFoldCandidate(FoldList, UseMI, UseOpIdx, FoldableImm);
1162-
return true;
1163-
}
1164-
}
1165-
11661137
return false;
11671138
}
11681139

0 commit comments

Comments
 (0)