miscompile: miscompile rv64: add,addi,andi,beq,bne,bnez

Run:explore-d9924131a4-20261128-105811
Kind:miscompile
Category:miscompile rv64: add,addi,andi,beq,bne,bnez M
Occurrences:1 in 1 configs, 1 test files
Snippet from:stores-of-loads-merging.f68f9e8d.cdaa9fe6.b6841bb4.b9dc7a41.57f65ac835.ll (mutant of stores-of-loads-merging.f68f9e8d.cdaa9fe6.b6841bb4.b9dc7a41.ll) @i8_i16_rotate via llvm-extract
Config:-mtriple=riscv64 -verify-machineinstrs -mattr=+v,+b,+zvfh,+xtheadba,+d -O2 -code-model=small
Local check:reproduces at d9924131a4
Compiler Explorer:not applicable: Compiler Explorer compiles RISC-V but cannot run it

Snippet:

@G.5 = external global ptr
@G.7 = external global i16

declare void @g()

define void @i8_i16_rotate(ptr %p, ptr %q) {
  %A7 = alloca i1, align 1
  store i1 false, ptr %A7, align 1
  %LGV = load i16, ptr @G.7, align 2
  %C = fcmp uge double f0x7FEFFFFFFFFFFFFF, +qnan
  switch i16 %LGV, label %SW_D3 [
    i16 -5457, label %SW_C4
    i16 2130, label %SW_C5
    i16 -21637, label %SW_C6
  ]

BB2:                                              ; preds = %SW_C5, %SW_D3
  br label %BB1

BB1:                                              ; preds = %BB2
  %A3 = alloca i64, align 8
  store i64 -1, ptr %A3, align 4
  %A = alloca ptr, align 8
  store ptr poison, ptr %A, align 8
  %p0 = getelementptr i8, ptr %p, i64 0
  %L1 = load i1, ptr %p0, align 1
  %p1 = getelementptr i8, ptr %p, i64 1
  %G = getelementptr i1, ptr %p0, i1 %L1
  %x0 = load i8, ptr %p0, align 2
  %L4 = load i64, ptr %A3, align 4
  store i1 %C, ptr %p1, align 1
  switch i64 %L4, label %SW_D [
    i64 -1482393206999530625, label %SW_C
  ]

BB:                                               ; preds = %SW_C, %SW_D
  %x1 = load i8, ptr %p1, align 1
  %B = and i1 true, %C
  %G1 = getelementptr i64, ptr %p1, i8 %x1
  call void @g()
  %q1 = getelementptr i8, ptr %q, i64 1
  store i8 %x1, ptr %G, align 2
  %G2 = getelementptr i1, ptr %p, i8 %x1
  store i8 %x0, ptr %q1, align 1
  store ptr %G2, ptr %A, align 8
  store ptr %G1, ptr @G.5, align 8
  store i1 %B, ptr %A3, align 1
  ret void

SW_D:                                             ; preds = %BB1
  br label %BB

SW_C:                                             ; preds = %BB1
  %G5 = getelementptr i64, ptr %q, i16 0
  store ptr %G5, ptr %A3, align 8
  br label %BB

SW_D3:                                            ; preds = %0
  br label %BB2

SW_C4:                                            ; preds = %0
  %C8 = icmp slt i128 18446744073709551616, 1
  store i1 %C8, ptr %A7, align 1
  ret void

SW_C5:                                            ; preds = %SW_C5, %0
  %L = load i1, ptr %A7, align 1
  %G9 = getelementptr ptr, ptr %A7, i16 %LGV
  store ptr %G9, ptr @G.5, align 8
  br i1 %L, label %SW_C5, label %BB2

SW_C6:                                            ; preds = %0
  ret void
}

Reproduce:

./exec_oracle.py --flags '-mtriple=riscv64 -verify-machineinstrs -mattr=+v,+b,+zvfh,+xtheadba,+d -O2 -code-model=small' --funcs i8_i16_rotate snippet.ll

Local execution result:

62 of 64 inputs differ (first: #1)
SelectionDAG hash 039cf65bb9a99530, GlobalISel hash 83612e0e07462fca
b0: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v,+b,+zvfh,+xtheadba,+d -code-model=small -O2 -global-isel=0
b1: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v,+b,+zvfh,+xtheadba,+d -code-model=small -O0 -global-isel=0
b2: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v,+b,+zvfh,+xtheadba,+d -code-model=small -O2 -global-isel -global-isel-abort=2

Occurrences (1):

InputFunctionConfig
stores-of-loads-merging.f68f9e8d.cdaa9fe6.b6841bb4.b9dc7a41.57f65ac835.ll (mutant of stores-of-loads-merging.f68f9e8d.cdaa9fe6.b6841bb4.b9dc7a41.ll)i8_i16_rotate-mtriple=riscv64 -verify-machineinstrs -mattr=+v,+b,+zvfh,+xtheadba,+d -O2 -code-model=small

Generated 2026-11-29 14:49 UTC.