Skip to content

Commit ca40989

Browse files
authored
AMDGPU: Permit more frame index operands in verifier (llvm#101691)
Treat FI operands more like a register. When it gets materialized, we will typically need to introduce a scavenged register anyway. Add baseline tests for folding frame indexes into add/or.
1 parent 536486f commit ca40989

5 files changed

+2126
-2
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4599,6 +4599,10 @@ static bool shouldReadExec(const MachineInstr &MI) {
45994599
return true;
46004600
}
46014601

4602+
static bool isRegOrFI(const MachineOperand &MO) {
4603+
return MO.isReg() || MO.isFI();
4604+
}
4605+
46024606
static bool isSubRegOf(const SIRegisterInfo &TRI,
46034607
const MachineOperand &SuperVec,
46044608
const MachineOperand &SubReg) {
@@ -4933,7 +4937,7 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
49334937
++ConstantBusCount;
49344938
SGPRsUsed.push_back(SGPRUsed);
49354939
}
4936-
} else {
4940+
} else if (!MO.isFI()) { // Treat FI like a register.
49374941
if (!UsesLiteral) {
49384942
++ConstantBusCount;
49394943
UsesLiteral = true;
@@ -5026,7 +5030,7 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
50265030
const MachineOperand &Src0 = MI.getOperand(Src0Idx);
50275031
const MachineOperand &Src1 = MI.getOperand(Src1Idx);
50285032

5029-
if (!Src0.isReg() && !Src1.isReg() &&
5033+
if (!isRegOrFI(Src0) && !isRegOrFI(Src1) &&
50305034
!isInlineConstant(Src0, Desc.operands()[Src0Idx]) &&
50315035
!isInlineConstant(Src1, Desc.operands()[Src1Idx]) &&
50325036
!Src0.isIdenticalTo(Src1)) {

0 commit comments

Comments
 (0)