Skip to content

Commit d2d025e

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 c1f8dbb commit d2d025e

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
@@ -1121,40 +1121,11 @@ bool SIFoldOperandsImpl::tryToFoldACImm(
11211121
if (!AMDGPU::isSISrcOperand(Desc, UseOpIdx))
11221122
return false;
11231123

1124-
MachineOperand &UseOp = UseMI->getOperand(UseOpIdx);
11251124
if (OpToFold.isImm() && OpToFold.isOperandLegal(*TII, *UseMI, UseOpIdx)) {
11261125
appendFoldCandidate(FoldList, UseMI, UseOpIdx, OpToFold);
11271126
return true;
11281127
}
11291128

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

0 commit comments

Comments
 (0)