miscompile: miscompile rv32: addi,andi,beq,beqz,lbu,li

Run:explore-b577f07195-20261129-105236
Kind:miscompile
Category:miscompile rv32: addi,andi,beq,beqz,lbu,li M
Occurrences:2 in 2 configs, 2 test files
Snippet from:get-register-noreserve.582b7465f0.ll (mutant of get-register-noreserve.ll) @get_stack via llvm-extract + llvm-reduce
Config:-mtriple=riscv32 -O0 -verify-machineinstrs
Local check:reproduces at b577f07195
Compiler Explorer:not applicable: Compiler Explorer compiles RISC-V but cannot run it

Snippet:

define i32 @get_stack(i64 %LGV) {
entry:
  %A = alloca i1, align 1
  switch i64 %LGV, label %SW_D [
    i64 3000780976952086000, label %SW_C
    i64 950122773815167369, label %SW_C1
  ]

SW_D:                                             ; preds = %entry
  %sp = call i32 @llvm.read_register.i32(metadata !0)
  ret i32 %sp

SW_C:                                             ; preds = %entry
  ret i32 0

SW_C1:                                            ; preds = %entry
  ret i32 0
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(read)
declare i32 @llvm.read_register.i32(metadata) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(read) }

!0 = !{!"sp\00"}

Reproduce:

./exec_oracle.py --flags '-mtriple=riscv32 -O0 -verify-machineinstrs' --funcs get_stack snippet.ll

Local execution result:

64 of 64 inputs differ (first: #0)
SelectionDAG hash 37890099c548c112, GlobalISel hash 7e9f942a5ecacf52
b0: llc -mtriple=riscv32 -verify-machineinstrs -O0 -global-isel=0
b1: llc -mtriple=riscv32 -verify-machineinstrs -O2 -global-isel=0
b2: llc -mtriple=riscv32 -verify-machineinstrs -O0 -global-isel -global-isel-abort=2

Occurrences (2):

InputFunctionConfig
fixed-vectors-extract-i1.be91b851.fcd750bb.778b34e2.d6675d27e4.ll (mutant of fixed-vectors-extract-i1.be91b851.fcd750bb.778b34e2.ll)extractelt_v1i1-mtriple=riscv32 -target-abi=ilp32d -verify-machineinstrs -mattr=+v,+zbs,+zfh -O1
get-register-noreserve.582b7465f0.ll (mutant of get-register-noreserve.ll)get_stack-mtriple=riscv32 -O0 -verify-machineinstrs

Generated 2026-11-29 14:49 UTC.