Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1121,40 +1121,11 @@ bool SIFoldOperandsImpl::tryToFoldACImm(
if (!AMDGPU::isSISrcOperand(Desc, UseOpIdx))
return false;

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

// TODO: Verify the following code handles subregisters correctly.
// TODO: Handle extract of global reference
if (UseOp.getSubReg())
return false;

if (!OpToFold.isReg())
return false;

Register UseReg = OpToFold.getReg();
if (!UseReg.isVirtual())
return false;

// Maybe it is just a COPY of an immediate itself.

// FIXME: Remove this handling. There is already special case folding of
// immediate into copy in foldOperand. This is looking for the def of the
// value the folding started from in the first place.
MachineInstr *Def = MRI->getVRegDef(UseReg);
if (Def && TII->isFoldableCopy(*Def)) {
MachineOperand &DefOp = Def->getOperand(1);
if (DefOp.isImm() && TII->isOperandLegal(*UseMI, UseOpIdx, &DefOp)) {
FoldableDef FoldableImm(DefOp.getImm(), OpToFold.DefRC,
OpToFold.DefSubReg);
appendFoldCandidate(FoldList, UseMI, UseOpIdx, FoldableImm);
return true;
}
}

return false;
}

Expand Down
Loading
Loading