miscompile: miscompile rv64: add,addi,andi,beq,beqz,call

Run:explore-db12fc36f6-20261127-115111
Kind:miscompile
Category:miscompile rv64: add,addi,andi,beq,beqz,call M
Occurrences:1 in 1 configs, 1 test files
Snippet from:pr139075.6bb6e4ea.f93e78d6.d2323208.818c0b5160.ll (mutant of pr139075.6bb6e4ea.f93e78d6.d2323208.ll) @a via llvm-extract
Config:-mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+zfa,+zihintpause,+zbkb -O0
Local check:reproduces at db12fc36f6
Compiler Explorer:not applicable: Compiler Explorer compiles RISC-V but cannot run it

Snippet:

@G = external global i128
@G.1 = external global i1
@G.2 = external global ptr
@G.3 = external global float
@G.4 = external global i1

define void @a(ptr %0, ptr %1) {
  %A4 = alloca i1, align 1
  %G10 = getelementptr ptr, ptr %1, i64 42
  store i1 false, ptr %A4, align 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %0, ptr align 4 %1, i64 2048, i1 false)
  %A = alloca ptr, align 8
  %L2 = load i1, ptr %A, align 1
  %L = load float, ptr %A, align 4
  store ptr poison, ptr %A, align 8
  store ptr %G10, ptr @G.2, align 8
  switch i1 %L2, label %SW_D [
    i1 true, label %SW_C
    i1 false, label %SW_C3
  ]

BB:                                               ; preds = %SW_C3, %SW_C, %SW_D, %BB
  %LGV = load i128, ptr @G, align 4
  %G = getelementptr <4 x float>, ptr %1, i128 %LGV
  store ptr %G, ptr %A, align 8
  %C = fcmp oeq float %L, +inf
  %G12 = getelementptr ptr, ptr %G, i1 %L2
  br i1 %L2, label %BB, label %BB2

BB2:                                              ; preds = %BB
  store i1 %C, ptr %G12, align 1
  %B = shl i1 %L2, %C
  store i1 %B, ptr @G.1, align 1
  ret void

SW_D:                                             ; preds = %2
  %LGV3 = load float, ptr @G.3, align 4
  %G6 = getelementptr ptr, ptr %1, i1 %L2
  %G8 = getelementptr ptr, ptr %0, i1 %L2
  store ptr %G6, ptr @G.2, align 8
  store ptr %G8, ptr @G.2, align 8
  %C4 = fcmp ult float %L, %LGV3
  store i1 %C4, ptr poison, align 1
  br label %BB

SW_C:                                             ; preds = %2
  %G5 = getelementptr i32, ptr %A4, i1 true
  %G7 = getelementptr ptr, ptr %0, i128 170141183460469231731687303715884105727
  %L1 = load float, ptr %G7, align 4
  %C2 = fcmp ugt float %L, %L1
  store ptr %G7, ptr %A4, align 8
  store i1 %C2, ptr %A4, align 1
  store ptr %G5, ptr %A4, align 8
  br label %BB

SW_C3:                                            ; preds = %SW_C3, %2
  %L5 = load i1, ptr %A4, align 1
  %C5 = icmp eq i1 %L2, %L2
  store i1 %C5, ptr @G.4, align 1
  br i1 %L5, label %SW_C3, 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,+zfa,+zihintpause,+zbkb -O0' --funcs a snippet.ll

Local execution result:

64 of 64 inputs differ (first: #0)
SelectionDAG hash fbea0af73f0182be, GlobalISel hash 4bd1efb08ee24428
b0: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+zfa,+zihintpause,+zbkb -O0 -global-isel=0
b1: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+zfa,+zihintpause,+zbkb -O2 -global-isel=0
b2: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+zfa,+zihintpause,+zbkb -O0 -global-isel -global-isel-abort=2

Occurrences (1):

InputFunctionConfig
pr139075.6bb6e4ea.f93e78d6.d2323208.818c0b5160.ll (mutant of pr139075.6bb6e4ea.f93e78d6.d2323208.ll)a-mtriple=riscv64 -verify-machineinstrs -mattr=+v,+zvl16384b,+zfa,+zihintpause,+zbkb -O0

Generated 2026-11-29 14:49 UTC.