Issue |
137254
|
Summary |
integer math miscompile from AArch64 global isel backend
|
Labels |
backend:AArch64,
miscompilation,
llvm:globalisel
|
Assignees |
|
Reporter |
regehr
|
here's a function:
```llvm
define i32 @f(i32 %0) {
%2 = sub nsw i32 %0, -2147483648
%3 = icmp sgt i32 %2, 0
%4 = select i1 %3, i32 1, i32 0
ret i32 %4
}
```
with global isel we're lowering it like this:
```
~/reduce$ ~/llvm-project/for-alive/bin/llc -global-isel -o - reduced.ll
.build_version macos, 15, 0
.section __TEXT,__text,regular,pure_instructions
.globl _f ; -- Begin function f
.p2align 2
_f: ; @f
.cfi_startproc
; %bb.0:
mov w8, #-2147483648 ; =0x80000000
cmn w0, w8
cset w0, gt
ret
.cfi_endproc
; -- End function
.subsections_via_symbols
~/reduce$
```
this code returns 0 for f(2147483649). however, the answer should be 1 and that is what we get if we run the code generated by the SDAG backend.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs