mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-14 13:07:31 +00:00
e1196d6d3e
overflowed on negation. This commit checks to make sure that neithe C nor X overflows. This requires that the RHS of X (a subtract instruction) be a constant integer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60275 91177308-0d34-0410-b5e6-96231b3b80d8
23 lines
464 B
LLVM
23 lines
464 B
LLVM
; RUN: llvm-as < %s | opt -instcombine -inline | llvm-dis | grep {715827882} | count 2
|
|
; PR3142
|
|
|
|
define i32 @a(i32 %X) nounwind readnone {
|
|
entry:
|
|
%0 = sub i32 0, %X
|
|
%1 = sdiv i32 %0, -3
|
|
ret i32 %1
|
|
}
|
|
|
|
define i32 @b(i32 %X) nounwind readnone {
|
|
entry:
|
|
%0 = call i32 @a(i32 -2147483648)
|
|
ret i32 %0
|
|
}
|
|
|
|
define i32 @c(i32 %X) nounwind readnone {
|
|
entry:
|
|
%0 = sub i32 0, -2147483648
|
|
%1 = sdiv i32 %0, -3
|
|
ret i32 %1
|
|
}
|