Skip to content

Commit b9f3e1e

Browse files
committed
AMDGPU: Delete redundant recursive copy handling code
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 3c6cd73 commit b9f3e1e

File tree

4 files changed

+410
-240
lines changed

4 files changed

+410
-240
lines changed

llvm/lib/Target/AMDGPU/SIFoldOperands.cpp

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

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

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

0 commit comments

Comments
 (0)