summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-11 22:55:00 +0000
committerChris Lattner <sabre@nondot.org>2008-10-11 22:55:00 +0000
commita6321b40c22025b09c1bbff9df7f4b0470835b0b (patch)
tree23bd4ecb03c450667ab12192e6b753500d38e5e1 /test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll
parent1b8f4bb4a1a46e8a2295bdaf0454a5c302863703 (diff)
downloadllvm-a6321b40c22025b09c1bbff9df7f4b0470835b0b.tar.gz
llvm-a6321b40c22025b09c1bbff9df7f4b0470835b0b.tar.bz2
llvm-a6321b40c22025b09c1bbff9df7f4b0470835b0b.tar.xz
Fix PR2697 by rewriting the '(X / pos) op neg' logic. This also changes
a couple other cases for clarity, but shouldn't affect correctness. Patch by Eli Friedman! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57387 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll')
-rw-r--r--test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll b/test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll
new file mode 100644
index 0000000000..dfe9c4a16c
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false}
+; PR2697
+
+define i1 @x(i32 %x) nounwind {
+ %div = sdiv i32 %x, 65536 ; <i32> [#uses=1]
+ %cmp = icmp slt i32 %div, -65536
+ ret i1 %cmp
+}