Skip to content

Commit 2e6b808

Browse files
authored
Reapply "AMDGPU: Remove redundant inline constant check (llvm#127582)" (llvm#837)
This reverts commit 766c635. The underlying problem was fixed by 22d65d8 "AMDGPU: Teach isOperandLegal about SALU literal restrictions (llvm#127626)"
1 parent d1343e7 commit 2e6b808

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/Target/AMDGPU/SIFoldOperands.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,7 @@ bool SIFoldOperandsImpl::tryToFoldACImm(
826826
return false;
827827

828828
uint8_t OpTy = Desc.operands()[UseOpIdx].OperandType;
829-
if (OpToFold.isImm() && TII->isInlineConstant(OpToFold, OpTy) &&
830-
TII->isOperandLegal(*UseMI, UseOpIdx, &OpToFold)) {
829+
if (OpToFold.isImm() && TII->isOperandLegal(*UseMI, UseOpIdx, &OpToFold)) {
831830
UseMI->getOperand(UseOpIdx).ChangeToImmediate(OpToFold.getImm());
832831
return true;
833832
}
@@ -847,8 +846,7 @@ bool SIFoldOperandsImpl::tryToFoldACImm(
847846
MachineOperand &UseOp = UseMI->getOperand(UseOpIdx);
848847
if (!UseOp.getSubReg() && Def && TII->isFoldableCopy(*Def)) {
849848
MachineOperand &DefOp = Def->getOperand(1);
850-
if (DefOp.isImm() && TII->isInlineConstant(DefOp, OpTy) &&
851-
TII->isOperandLegal(*UseMI, UseOpIdx, &DefOp)) {
849+
if (DefOp.isImm() && TII->isOperandLegal(*UseMI, UseOpIdx, &DefOp)) {
852850
UseMI->getOperand(UseOpIdx).ChangeToImmediate(DefOp.getImm());
853851
return true;
854852
}

0 commit comments

Comments
 (0)