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

Run:explore-db12fc36f6-20261127-115111
Kind:miscompile
Category:miscompile rv64: addi,andi,beq,beqz,bne,bnez M
Occurrences:1 in 1 configs, 1 test files
Snippet from:pr139075.6465d626.1a71daf8.7e16587b.7d13b63e.8747234124.ll (mutant of pr139075.6465d626.1a71daf8.7e16587b.7d13b63e.ll) @a via llvm-extract
Config:-mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+f,+zve64d,+zba,+zve32x,+zbb -O3
Local check:reproduces at db12fc36f6
Compiler Explorer:not applicable: Compiler Explorer compiles RISC-V but cannot run it

Snippet:

@G.1 = external global ptr
@G.3 = external global i1
@G.4 = external global float
@G.5 = external global i1
@G.6 = external global ptr
@G.7 = external global i128
@G.8 = external global ptr
@G.9 = external global ptr
@G.10 = external global i8
@G.11 = external global i64

define void @a(ptr %0, ptr %1) {
  %A12 = alloca i1, align 1
  store i1 poison, ptr %A12, align 1
  %A2 = alloca i16, align 2
  store i16 256, ptr %A2, align 2
  %A = alloca i1, align 1
  %L11 = load i8, ptr %A, align 1
  %L4 = load i8, ptr %A, align 1
  %L3 = load i8, ptr %A, align 1
  store i1 poison, ptr %A, align 1
  %LGV = load i8, ptr @G.10, align 1
  %LGV5 = load i128, ptr @G.7, align 4
  %C8 = fcmp oeq float +inf, 1.000000e+00
  %G4 = getelementptr inbounds ptr, ptr %1, i1 false
  %L = load i128, ptr %G4, align 4
  %LGV1 = load float, ptr @G.4, align 4
  %C2 = fcmp ueq float 1.401300e-45, %LGV1
  %G3 = getelementptr ptr, ptr %1, i1 %C2
  %G10 = getelementptr i128, ptr %0, i32 0
  %L10 = load float, ptr %G10, align 4
  %C6 = icmp sle i128 %L, %LGV5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %0, ptr align 4 %1, i64 2048, i1 false)
  %G = getelementptr half, ptr %0, i1 true
  store ptr %G, ptr @G.1, align 8
  store i1 %C8, ptr @G.3, align 1
  store i1 %C6, ptr @G.3, align 1
  %B5 = shl i8 %L3, %L4
  store i1 %C2, ptr @G.5, align 1
  %G2 = getelementptr float, ptr %1, i1 %C6
  %G13 = getelementptr ptr, ptr %A, i16 42
  store ptr %G4, ptr @G.6, align 8
  store ptr %G10, ptr @G.8, align 8
  store ptr %G2, ptr @G.9, align 8
  store i8 %B5, ptr @G.10, align 1
  switch i8 %LGV, label %SW_D [
    i8 -10, label %SW_C
    i8 -93, label %SW_C4
    i8 17, label %SW_C5
  ]

BB:                                               ; preds = %SW_C5, %BB1, %SW_C, %SW_D
  store ptr %G3, ptr %G2, align 8
  %G7 = getelementptr i128, ptr %1, i1 false
  store ptr %G7, ptr %A, align 8
  ret void

SW_D:                                             ; preds = %SW_D, %2
  %3 = phi i8 [ %3, %SW_D ], [ %L11, %2 ]
  %C = fcmp false float %LGV1, %L10
  store i1 %C, ptr %A, align 1
  store i8 %3, ptr %A, align 1
  br i1 %C6, label %SW_D, label %BB

SW_C:                                             ; preds = %2
  %G8 = getelementptr i1, ptr %1, i1 true
  store ptr %G8, ptr %G13, align 8
  br label %BB

SW_C4:                                            ; preds = %BB1, %2
  %4 = phi float [ %4, %BB1 ], [ %L10, %2 ]
  %L5 = load i16, ptr %A2, align 2
  %B10 = lshr i16 %L5, 0
  switch i16 %B10, label %SW_D6 [
    i16 29242, label %SW_C7
    i16 -14970, label %SW_C8
    i16 -25515, label %SW_C9
  ]

BB1:                                              ; preds = %SW_C9
  %G9 = getelementptr ptr, ptr %0, i1 %C6
  store float %4, ptr %G9, align 4
  br i1 %C2, label %BB, label %SW_C4

SW_C5:                                            ; preds = %2
  %B = udiv i64 0, 9223372036854775807
  store i64 %B, ptr @G.11, align 4
  br label %BB

SW_D6:                                            ; preds = %SW_C4
  ret void

SW_C7:                                            ; preds = %SW_C4
  ret void

SW_C8:                                            ; preds = %SW_C4
  ret void

SW_C9:                                            ; preds = %SW_C4
  %G15 = getelementptr i16, ptr %0, i32 0
  %C11 = fcmp olt float %4, %LGV1
  store i1 %C11, ptr %A12, align 1
  store ptr %G15, ptr %A12, align 8
  br label %BB1
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }

Reproduce:

./exec_oracle.py --flags '-mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+f,+zve64d,+zba,+zve32x,+zbb -O3' --funcs a snippet.ll

Local execution result:

64 of 64 inputs differ (first: #0)
SelectionDAG hash c674986bdf971efb, GlobalISel hash b422c8b2d4029262
b0: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+f,+zve64d,+zba,+zve32x,+zbb -O3 -global-isel=0
b1: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+f,+zve64d,+zba,+zve32x,+zbb -O0 -global-isel=0
b2: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+f,+zve64d,+zba,+zve32x,+zbb -O3 -global-isel -global-isel-abort=2

Occurrences (1):

InputFunctionConfig
pr139075.6465d626.1a71daf8.7e16587b.7d13b63e.8747234124.ll (mutant of pr139075.6465d626.1a71daf8.7e16587b.7d13b63e.ll)a-mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+f,+zve64d,+zba,+zve32x,+zbb -O3

Generated 2026-11-29 14:49 UTC.