Skip to content

Commit a6089a9

Browse files
authored
[AMDGPU] Ignore RegMask operands when folding operands to SALU insts (#130813)
Otherwise we hit an assert in isInlineConstant.
1 parent 15e335f commit a6089a9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6067,7 +6067,7 @@ bool SIInstrInfo::isOperandLegal(const MachineInstr &MI, unsigned OpIdx,
60676067
if (i == OpIdx)
60686068
continue;
60696069
const MachineOperand &Op = MI.getOperand(i);
6070-
if (!Op.isReg() && !Op.isFI() &&
6070+
if (!Op.isReg() && !Op.isFI() && !Op.isRegMask() &&
60716071
!isInlineConstant(Op, InstDesc.operands()[i]) &&
60726072
!Op.isIdenticalTo(*MO))
60736073
return false;

llvm/test/CodeGen/AMDGPU/fold-sgpr-multi-imm.mir

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,18 @@ body: |
268268
%0:sreg_32 = S_MOV_B32 80
269269
S_CMP_EQ_U32 %0, 64, implicit-def $scc
270270
...
271+
272+
# Ignore regmask operands
273+
# GCN-LABEL: name: test_si_cs_chain_fold_with_regmask{{$}}
274+
# GCN: SI_CS_CHAIN_TC_W32 %0, 0, 0, 1234, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8
275+
---
276+
name: test_si_cs_chain_fold_with_regmask
277+
tracksRegLiveness: true
278+
body: |
279+
bb.0:
280+
liveins: $sgpr0, $sgpr2_sgpr3, $vgpr8
281+
282+
%1:ccr_sgpr_64 = COPY $sgpr2_sgpr3
283+
%2:sreg_32 = S_MOV_B32 1234
284+
SI_CS_CHAIN_TC_W32 %1:ccr_sgpr_64, 0, 0, %2:sreg_32, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8
285+
...

0 commit comments

Comments
 (0)