Skip to content

Commit 71c1282

Browse files
authored
[Mips] Fix inst sc disassemble assert when configured -mattr=+ptr64 (#158253)
When mips disassembler process `DecodeMem`, does not consider Mips::SC64, leading to `Operands.size() = 3`. And the right `Size` value is 4, when printMemOperand would occur asserts: `assert(idx < size());` Fix #157508.
1 parent b5e06b5 commit 71c1282

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ static DecodeStatus DecodeMem(MCInst &Inst, unsigned Insn, uint64_t Address,
10031003
Reg = getReg(Decoder, Mips::GPR32RegClassID, Reg);
10041004
Base = getReg(Decoder, Mips::GPR32RegClassID, Base);
10051005

1006-
if (Inst.getOpcode() == Mips::SC ||
1006+
if (Inst.getOpcode() == Mips::SC || Inst.getOpcode() == Mips::SC64 ||
10071007
Inst.getOpcode() == Mips::SCD)
10081008
Inst.addOperand(MCOperand::createReg(Reg));
10091009

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# RUN: llvm-mc -triple=mips64el-unknown-linux -disassemble -mattr=+ptr64 -mcpu=mips3 %s | FileCheck %s
2+
3+
0xd8 0x49 0x6f 0xe2 # CHECK: sc $15, 18904($19)

0 commit comments

Comments
 (0)