miscompile: miscompile rv32: addi,andi,beq,beqz,bltu,bne
| Run: | explore-b577f07195-20261129-105236 |
| Kind: | miscompile |
| Category: | miscompile rv32: addi,andi,beq,beqz,bltu,bne NEW M |
| Occurrences: | 1 in 1 configs, 1 test files |
| Snippet from: | readcyclecounter.bff0a056.7245d999.b7bb1c636d.ll (mutant of readcyclecounter.bff0a056.7245d999.ll) @test_builtin_readcyclecounter via llvm-extract |
| Config: | -mtriple=riscv32 -verify-machineinstrs -mattr=+f,+zicond,+d,+zba,+zfhmin -O3 -code-model=small |
| Local check: | reproduces at b577f07195 |
| Compiler Explorer: | not applicable: Compiler Explorer compiles RISC-V but cannot run it |
Snippet:
@G = external global i64
@G.1 = external global i1
@G.2 = external global i1
; Function Attrs: nounwind
define i64 @test_builtin_readcyclecounter() #0 {
%A15 = alloca i1, align 1
store i1 false, ptr %A15, align 1
%A12 = alloca i1, align 1
store i1 false, ptr %A12, align 1
%A8 = alloca i1, align 1
store i1 false, ptr %A8, align 1
%A = alloca i1, align 1
store i1 true, ptr %A, align 1
%LGV = load i64, ptr @G, align 4
switch i64 %LGV, label %SW_D [
i64 4303199021846014237, label %SW_C
i64 2825014246696475366, label %SW_C1
i64 -1124663481073590762, label %SW_C2
i64 -126088060032052412, label %SW_C3
i64 5381856492718128585, label %SW_C4
i64 -1449714065303366033, label %SW_C5
i64 -3830871222338784181, label %SW_C6
i64 8167191317104177415, label %SW_C7
]
BB: ; preds = %SW_C6, %SW_C5, %SW_C4, %SW_C2, %SW_C1, %SW_C, %SW_D
%1 = tail call i64 @llvm.readcyclecounter()
%B = ashr i64 %1, %1
ret i64 %B
SW_D: ; preds = %SW_D, %0
%L = load i1, ptr %A, align 1
%B1 = udiv i1 %L, false
br i1 %B1, label %BB, label %SW_D
SW_C: ; preds = %SW_C, %0
%L9 = load i1, ptr %A8, align 1
%C = icmp ugt i32 65536, -1
store i1 %C, ptr %A15, align 1
br i1 %L9, label %SW_C, label %BB
SW_C1: ; preds = %0
br label %BB
SW_C2: ; preds = %SW_C2, %0
%LGV10 = load i1, ptr @G.1, align 1
br i1 %LGV10, label %BB, label %SW_C2
SW_C3: ; preds = %0
ret i64 0
SW_C4: ; preds = %SW_C4, %0
%LGV11 = load i1, ptr @G.2, align 1
br i1 %LGV11, label %BB, label %SW_C4
SW_C5: ; preds = %SW_C5, %0
%L13 = load i1, ptr %A12, align 1
br i1 %L13, label %SW_C5, label %BB
SW_C6: ; preds = %SW_C6, %0
%L16 = load i1, ptr %A15, align 1
%G = getelementptr ptr, ptr %A, i64 %LGV
store ptr %G, ptr poison, align 8
br i1 %L16, label %BB, label %SW_C6
SW_C7: ; preds = %0
ret i64 %LGV
}
; Function Attrs: nocallback nofree nosync nounwind willreturn
declare i64 @llvm.readcyclecounter() #1
attributes #0 = { nounwind }
attributes #1 = { nocallback nofree nosync nounwind willreturn }
Reproduce:
./exec_oracle.py --flags '-mtriple=riscv32 -verify-machineinstrs -mattr=+f,+zicond,+d,+zba,+zfhmin -O3 -code-model=small' --funcs test_builtin_readcyclecounter snippet.ll
Local execution result:
3 of 64 inputs differ (first: #23)
SelectionDAG hash b60d6243a1c56749, GlobalISel hash db77259a4370d3ef
b0: llc -mtriple=riscv32 -verify-machineinstrs -mattr=+f,+zicond,+d,+zba,+zfhmin -code-model=small -O3 -global-isel=0
b1: llc -mtriple=riscv32 -verify-machineinstrs -mattr=+f,+zicond,+d,+zba,+zfhmin -code-model=small -O0 -global-isel=0
b2: llc -mtriple=riscv32 -verify-machineinstrs -mattr=+f,+zicond,+d,+zba,+zfhmin -code-model=small -O3 -global-isel -global-isel-abort=2
Occurrences (1):
| Input | Function | Config |
|---|
| readcyclecounter.bff0a056.7245d999.b7bb1c636d.ll (mutant of readcyclecounter.bff0a056.7245d999.ll) | test_builtin_readcyclecounter | -mtriple=riscv32 -verify-machineinstrs -mattr=+f,+zicond,+d,+zba,+zfhmin -O3 -code-model=small |
Generated 2026-11-29 14:49 UTC.