miscompile: miscompile rv32: add,addi,andi,andn,beq,beqz
| Run: | explore-b577f07195-20261129-105236 |
| Kind: | miscompile |
| Category: | miscompile rv32: add,addi,andi,andn,beq,beqz M |
| Occurrences: | 1 in 1 configs, 1 test files |
| Snippet from: | mem.8f2b3cb5.3a22d576.57dcc594.c56d7c42.76aafd14.beddb9f7a6.ll (mutant of mem.8f2b3cb5.3a22d576.57dcc594.c56d7c42.76aafd14.ll) @load_sext_zext_anyext_i1_i16 via llvm-extract |
| Config: | -mtriple=riscv32 -verify-machineinstrs -mattr=+zicond,+zbb,+zba,+zihintpause,+zfa,+v,+xtheadba -O3 |
| Local check: | reproduces at b577f07195 |
| Compiler Explorer: | not applicable: Compiler Explorer compiles RISC-V but cannot run it |
Snippet:
@G.2 = external global i1
@G.3 = external global i64
@G.4 = external global i16
@G.5 = external global i1
@G.6 = external global i1
@G.7 = external global i128
@G.8 = external global i16
@G.9 = external global ptr
@G.10 = external global double
@G.11 = external global double
; Function Attrs: nounwind
define dso_local i16 @load_sext_zext_anyext_i1_i16(ptr %a) #0 {
%LGV11 = load double, ptr @G.10, align 8
%LGV2 = load i128, ptr @G.7, align 4
%B10 = sub i32 2147483647, 0
%LGV6 = load i1, ptr @G.6, align 1
%B12 = fdiv double +inf, %LGV11
%LGV1 = load i1, ptr @G.5, align 1
%LGV = load i64, ptr @G.3, align 4
%1 = getelementptr i1, ptr %a, i32 1
%L1 = load i16, ptr %1, align 2
%G = getelementptr <2 x i64>, ptr %a, i64 %LGV
%G6 = getelementptr half, ptr %a, i64 4294967296
%L = load i1, ptr %1, align 1
%2 = load i1, ptr %1, align 1
%3 = sext i1 %2 to i16
%B4 = sdiv i1 %L, %LGV1
%G8 = getelementptr i1, ptr %a, i1 %LGV6
%B2 = or i64 %LGV, -1
%G7 = getelementptr ptr, ptr %G8, i1 %2
%B3 = or i16 %3, %L1
%4 = getelementptr i1, ptr %a, i32 2
%5 = load i1, ptr %4, align 1
%B = ashr i16 %3, %3
%6 = zext i1 %5 to i16
%7 = add i16 %B, %6
%8 = load volatile i1, ptr %a, align 1
%C = icmp sgt i1 %B4, %8
store i1 %C, ptr @G.2, align 1
store i64 %B2, ptr %4, align 4
store double %B12, ptr @G.11, align 8
switch i128 %LGV2, label %SW_D [
i128 16680564323209701041, label %SW_C
i128 13702346112693397940, label %SW_C3
i128 2096854806830393827, label %SW_C4
i128 7171347041096829819, label %SW_C5
i128 6829352875523254267, label %SW_C6
]
BB: ; preds = %SW_C6, %SW_C, %SW_D
store ptr %G, ptr %4, align 8
store ptr %G7, ptr %4, align 8
store i16 %B3, ptr @G.4, align 2
store ptr %G6, ptr %G7, align 8
store i32 %B10, ptr %4, align 4
ret i16 %7
SW_D: ; preds = %0
br label %BB
SW_C: ; preds = %SW_C, %0
br i1 %8, label %SW_C, label %BB
SW_C3: ; preds = %0
ret i16 0
SW_C4: ; preds = %0
%LGV8 = load i16, ptr @G.8, align 2
%G10 = getelementptr ptr, ptr %a, i128 0
store ptr %G10, ptr @G.9, align 8
ret i16 %LGV8
SW_C5: ; preds = %0
ret i16 %B
SW_C6: ; preds = %SW_C6, %0
br i1 %LGV1, label %SW_C6, label %BB
}
attributes #0 = { nounwind }
Reproduce:
./exec_oracle.py --flags '-mtriple=riscv32 -verify-machineinstrs -mattr=+zicond,+zbb,+zba,+zihintpause,+zfa,+v,+xtheadba -O3' --funcs load_sext_zext_anyext_i1_i16 snippet.ll
Local execution result:
64 of 64 inputs differ (first: #0)
SelectionDAG hash 9b6adb5b11399ec6, GlobalISel hash 40a6012a176bbca7
b0: llc -mtriple=riscv32 -verify-machineinstrs -mattr=+zicond,+zbb,+zba,+zihintpause,+zfa,+v,+xtheadba -O3 -global-isel=0
b1: llc -mtriple=riscv32 -verify-machineinstrs -mattr=+zicond,+zbb,+zba,+zihintpause,+zfa,+v,+xtheadba -O0 -global-isel=0
b2: llc -mtriple=riscv32 -verify-machineinstrs -mattr=+zicond,+zbb,+zba,+zihintpause,+zfa,+v,+xtheadba -O3 -global-isel -global-isel-abort=2
Occurrences (1):
| Input | Function | Config |
|---|
| mem.8f2b3cb5.3a22d576.57dcc594.c56d7c42.76aafd14.beddb9f7a6.ll (mutant of mem.8f2b3cb5.3a22d576.57dcc594.c56d7c42.76aafd14.ll) | load_sext_zext_anyext_i1_i16 | -mtriple=riscv32 -verify-machineinstrs -mattr=+zicond,+zbb,+zba,+zihintpause,+zfa,+v,+xtheadba -O3 |
Generated 2026-11-29 14:49 UTC.