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

Run:explore-d9924131a4-20261128-105811
Kind:miscompile
Category:miscompile rv64: addi,andi,beq,beqz,bne,bnez M
Occurrences:2 in 2 configs, 1 test files
Snippet from:pr139075.6465d626.1a71daf8.7e16587b.7d13b63e.5c3a868639.ll (mutant of pr139075.6465d626.1a71daf8.7e16587b.7d13b63e.ll) @a via llvm-extract
Config:-mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+zve64d,+zba,+zfh -O3
Local check:reproduces at d9924131a4
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) {
  %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, %SW_C4, %SW_C, %SW_D
  store ptr %G3, ptr %G2, align 8
  %C3 = fcmp oge bfloat 4.200000e+01, +inf
  %G7 = getelementptr i128, ptr %1, i1 false
  store ptr %G7, ptr %A, align 8
  store i1 %C3, ptr %G7, align 1
  ret void

SW_D:                                             ; preds = %SW_D, %2
  %3 = phi i8 [ %3, %SW_D ], [ %L11, %2 ]
  %C = fcmp uge 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 = %SW_C4, %2
  %4 = phi float [ %4, %SW_C4 ], [ %L10, %2 ]
  %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
}

; 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,+zve64d,+zba,+zfh -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,+zve64d,+zba,+zfh -O3 -global-isel=0
b1: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+zve64d,+zba,+zfh -O0 -global-isel=0
b2: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+zve64d,+zba,+zfh -O3 -global-isel -global-isel-abort=2

Occurrences (2):

InputFunctionConfig
pr139075.6465d626.1a71daf8.7e16587b.7d13b63e.5c3a868639.ll (mutant of pr139075.6465d626.1a71daf8.7e16587b.7d13b63e.ll)a-mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+zve64d,+zba,+zfh -O3
pr139075.6465d626.1a71daf8.7e16587b.7d13b63e.935e843e9c.ll (mutant of pr139075.6465d626.1a71daf8.7e16587b.7d13b63e.ll)a-mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+f,+zve64d,+zba,+zvkb -O1

Generated 2026-11-29 14:49 UTC.