summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-08-22 00:40:43 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-08-22 00:40:43 +0000
commit97ddca3224e13760bd3936188585074d10caafb6 (patch)
tree80474f18e524a55d11850aabcb366d542fb78607 /llvm/test/Transforms
parentffe5e5a42d929e3fd8fe5226822fd73c4ce8b389 (diff)
downloadbcm5719-llvm-97ddca3224e13760bd3936188585074d10caafb6.tar.gz
bcm5719-llvm-97ddca3224e13760bd3936188585074d10caafb6.zip
ValueTracking: Figure out more bits when looking at add/sub
Given something like X01XX + X01XX, we know that the result must look like X1XXX. Adapted from a patch by Richard Smith, test-case written by me. llvm-svn: 216250
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstSimplify/compare.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/compare.ll b/llvm/test/Transforms/InstSimplify/compare.ll
index 94872d35bb9..27fe1bead23 100644
--- a/llvm/test/Transforms/InstSimplify/compare.ll
+++ b/llvm/test/Transforms/InstSimplify/compare.ll
@@ -969,3 +969,16 @@ define i1 @icmp_sdiv_neg1(i64 %a) {
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[DIV]], 1073741824
; CHECK-NEXT: ret i1 [[CMP]]
}
+
+define i1 @icmp_known_bits(i4 %x, i4 %y) {
+ %and1 = and i4 %y, -7
+ %and2 = and i4 %x, -7
+ %or1 = or i4 %and1, 2
+ %or2 = or i4 %and2, 2
+ %add = add i4 %or1, %or2
+ %cmp = icmp eq i4 %add, 0
+ ret i1 %cmp
+
+; CHECK-LABEL: @icmp_known_bits
+; CHECK-NEXT: ret i1 false
+}
OpenPOWER on IntegriCloud