diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-07-14 19:49:57 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-07-14 19:49:57 +0000 |
commit | 5ea4fc0b33d12c51cc55297747057c00942db662 (patch) | |
tree | 77881cbf6ef9b31a8f4549f98dd2e13162dc7d24 /llvm/test/Transforms/InstSimplify/compare.ll | |
parent | 6b7f73451f7e83ff3c9e175ab47af444486fd2d7 (diff) | |
download | bcm5719-llvm-5ea4fc0b33d12c51cc55297747057c00942db662.tar.gz bcm5719-llvm-5ea4fc0b33d12c51cc55297747057c00942db662.zip |
InstSimplify: The upper bound of X / C was missing a rounding step
Summary:
When calculating the upper bound of X / -8589934592, we would perform
the following calculation: Floor[INT_MAX / 8589934592]
However, flooring the result would make us wrongly come to the
conclusion that 1073741824 was not in the set of possible values.
Instead, use the ceiling of the result.
Reviewers: nicholas
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D4502
llvm-svn: 212976
Diffstat (limited to 'llvm/test/Transforms/InstSimplify/compare.ll')
-rw-r--r-- | llvm/test/Transforms/InstSimplify/compare.ll | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/compare.ll b/llvm/test/Transforms/InstSimplify/compare.ll index 7d0cd9c5878..d329b7b719f 100644 --- a/llvm/test/Transforms/InstSimplify/compare.ll +++ b/llvm/test/Transforms/InstSimplify/compare.ll @@ -913,3 +913,14 @@ define i1 @icmp_sdiv_int_min(i32 %a) { ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[DIV]], -1073741824 ; CHECK-NEXT: ret i1 [[CMP]] } + +define i1 @icmp_sdiv_pr20288(i64 %a) { + %div = sdiv i64 %a, -8589934592 + %cmp = icmp ne i64 %div, 1073741824 + ret i1 %cmp + +; CHECK-LABEL: @icmp_sdiv_pr20288 +; CHECK-NEXT: [[DIV:%.*]] = sdiv i64 %a, -8589934592 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[DIV]], 1073741824 +; CHECK-NEXT: ret i1 [[CMP]] +} |