Skip to content

Commit d7af9f1

Browse files
committed
[DO_NOT_MERGE][RVY] Add a call to RISCV_MC::verifyInstructionPredicates
This ensures the broken Asmparser expansions trigger a crash
1 parent 9b7a809 commit d7af9f1

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3546,6 +3546,8 @@ void RISCVAsmParser::emitToStreamer(MCStreamer &S, const MCInst &Inst) {
35463546
Res = RISCVRVC::compress(CInst, Inst, STI);
35473547
if (Res)
35483548
++RISCVNumInstrsCompressed;
3549+
// This catches the broken CHERI expansions
3550+
RISCV_MC::verifyInstructionPredicates(Inst.getOpcode(), STI.getFeatureBits());
35493551
S.emitInstruction((Res ? CInst : Inst), STI);
35503552
}
35513553

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# RUN: not llvm-mc --triple riscv32 --mattr=+experimental-y,+cap-mode <%s 2>&1 \
2+
# RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-32 '--implicit-check-not=error:'
3+
# RUN: not llvm-mc --triple riscv64 --mattr=+experimental-y,+cap-mode <%s 2>&1 \
4+
# RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-64 '--implicit-check-not=error:'
5+
6+
# TODO: support expanding these pseudos
7+
lw a0, sym
8+
ld a0, sym
9+
# CHECK-32: [[#@LINE-1]]:1: error: instruction requires the following: 'Zilsd' (Load/Store pair instructions)
10+
ly a0, sym
11+
# CHECK: [[#@LINE-1]]:8: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
12+
13+
.data
14+
sym:
15+
.4byte 0

0 commit comments

Comments
 (0)