summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-05-15 00:02:20 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-05-15 00:02:20 +0000
commit186c94244c96b25bf4cd4924dc1db335d849e5c9 (patch)
treef387cf98c0f46eb530ca36e2955f1dcdf5cb2eeb /llvm/test/Transforms/InstCombine
parentceae1fbafd13b67cf0c6d5d784ada87455fd9a2f (diff)
downloadbcm5719-llvm-186c94244c96b25bf4cd4924dc1db335d849e5c9.tar.gz
bcm5719-llvm-186c94244c96b25bf4cd4924dc1db335d849e5c9.zip
InstCombine: Optimize -x s< cst
Summary: This gets rid of a sub instruction by moving the negation to the constant when valid. Reviewers: nicholas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D3773 llvm-svn: 208827
Diffstat (limited to 'llvm/test/Transforms/InstCombine')
-rw-r--r--llvm/test/Transforms/InstCombine/icmp.ll9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll
index 12a4744cc0f..f45897cd3ee 100644
--- a/llvm/test/Transforms/InstCombine/icmp.ll
+++ b/llvm/test/Transforms/InstCombine/icmp.ll
@@ -1356,3 +1356,12 @@ define i1 @icmp_ashr_ashr_ne(i32 %a, i32 %b) nounwind {
%z = icmp ne i32 %x, %y
ret i1 %z
}
+
+; CHECK-LABEL: @icmp_neg_cst_slt
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp sgt i32 %a, 10
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_neg_cst_slt(i32 %a) {
+ %1 = sub nsw i32 0, %a
+ %2 = icmp slt i32 %1, -10
+ ret i1 %2
+}
OpenPOWER on IntegriCloud