[llvm] [RISC-V][MC] Validate instructions prior to emission in AsmParser (PR #171739)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 16:18:46 PST 2025


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 167030 tests passed
* 2925 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.MC/RISCV/rv32p-valid.s</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/RISCV/rv32p-valid.s -triple=riscv32 -mattr=+experimental-p -M no-aliases -show-encoding      | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/RISCV/rv32p-valid.s
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/RISCV/rv32p-valid.s -triple=riscv32 -mattr=+experimental-p -M no-aliases -show-encoding
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/RISCV/rv32p-valid.s:705:1: error: PWADDA_H operand 1 register X6 is not a member of register class GPRPair
# | # CHECK-ASM-AND-OBJ: wadda s2, t1, a0
# | ^
# | LLVM ERROR: Attempting to emit invalid instruction. Incorrect pseudo expansion?
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.	Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/RISCV/rv32p-valid.s -triple=riscv32 -mattr=+experimental-p -M no-aliases -show-encoding
# |  #0 0x0000000002ce6a18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:834:13
# |  #1 0x0000000002ce4165 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:105:18
# |  #2 0x0000000002ce77d1 SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:426:38
# |  #3 0x00007c1e66c09330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
# |  #4 0x00007c1e66c62b2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
# |  #5 0x00007c1e66c0927e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
# |  #6 0x00007c1e66bec8ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
# |  #7 0x0000000002ca5be5 llvm::report_fatal_error(llvm::Twine const&, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/ErrorHandling.cpp:137:5
# |  #8 0x0000000002ca5a26 (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc+0x2ca5a26)
# |  #9 0x0000000002ca5cab (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc+0x2ca5cab)
# | #10 0x00000000027f1b17 (anonymous namespace)::RISCVAsmParser::emitToStreamer(llvm::MCStreamer&, llvm::MCInst const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:0:9
# | #11 0x00000000027e72d5 processInstruction /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:0:3
# | #12 0x00000000027e72d5 (anonymous namespace)::RISCVAsmParser::matchAndEmitInstruction(llvm::SMLoc, unsigned int&, llvm::SmallVectorImpl<std::unique_ptr<llvm::MCParsedAsmOperand, std::default_delete<llvm::MCParsedAsmOperand>>>&, llvm::MCStreamer&, unsigned long&, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:1409:12
# | #13 0x0000000002c5cc01 (anonymous namespace)::AsmParser::parseAndMatchAndEmitTargetInstruction((anonymous namespace)::ParseStatementInfo&, llvm::StringRef, llvm::AsmToken, llvm::SMLoc) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/MC/MCParser/AsmParser.cpp:2294:27
# | #14 0x0000000002c50c0e (anonymous namespace)::AsmParser::parseStatement((anonymous namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/MC/MCParser/AsmParser.cpp:2227:10
# | #15 0x0000000002c49dd1 (anonymous namespace)::AsmParser::Run(bool, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/MC/MCParser/AsmParser.cpp:0:0
# | #16 0x00000000026c024b AssembleInput(char const*, llvm::Target const*, llvm::SourceMgr&, llvm::MCContext&, llvm::MCStreamer&, llvm::MCAsmInfo&, llvm::MCSubtargetInfo&, llvm::MCInstrInfo&, llvm::MCTargetOptions const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llvm-mc/llvm-mc.cpp:375:13
# | #17 0x00000000026bef26 main /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llvm-mc/llvm-mc.cpp:0:0
# | #18 0x00007c1e66bee1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
# | #19 0x00007c1e66bee28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
# | #20 0x00000000026b8db5 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc+0x26b8db5)
# `-----------------------------
# error: command failed with exit status: -6
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/RISCV/rv32p-valid.s
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/RISCV/rv32p-valid.s:679:14: error: CHECK-ASM: expected string not found in input
# | # CHECK-ASM: encoding: [0x1b,0x27,0xe6,0x4b]
# |              ^
# | <stdin>:226:21: note: scanning from here
# |  pwsla.hs a4, a2, t5 
# |                     ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/RISCV/rv32p-valid.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |          221:  plui.dh tp, -412 # encoding: [0x1b,0x22,0x99,0x70] 
# |          222:  pwsll.bs t3, t1, s0 # encoding: [0x1b,0x2e,0x83,0x08] 
# |          223:  pwsll.hs s0, a4, t1 # encoding: [0x1b,0x24,0x67,0x0a] 
# |          224:  wsll a0, s0, s2 # encoding: [0x1b,0x25,0x24,0x0f] 
# |          225:  pwsla.bs s0, s0, s0 # encoding: [0x1b,0x24,0x84,0x48] 
# |          226:  pwsla.hs a4, a2, t5 
# | check:679                         X error: no match found
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/171739


More information about the llvm-commits mailing list