summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2013-07-09 22:01:22 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2013-07-09 22:01:22 +0000
commit8c5c6f0e090f91b6555cdd9d2eea238fff3befe6 (patch)
tree8d3a93378e1e1c3c148122b14136a9c685ca9891 /test
parente4e742a62d5efa8f69b351dde87f9a20c03503ef (diff)
downloadllvm-8c5c6f0e090f91b6555cdd9d2eea238fff3befe6.tar.gz
llvm-8c5c6f0e090f91b6555cdd9d2eea238fff3befe6.tar.bz2
llvm-8c5c6f0e090f91b6555cdd9d2eea238fff3befe6.tar.xz
InstSimplify: X >> X -> 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185973 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/div-shift.ll6
-rw-r--r--test/Transforms/InstSimplify/compare.ll16
2 files changed, 19 insertions, 3 deletions
diff --git a/test/Transforms/InstCombine/div-shift.ll b/test/Transforms/InstCombine/div-shift.ll
index 46d0f9afd7..3350f19405 100644
--- a/test/Transforms/InstCombine/div-shift.ll
+++ b/test/Transforms/InstCombine/div-shift.ll
@@ -54,9 +54,9 @@ define i32 @t5(i1 %x, i1 %y, i32 %V) nounwind {
; CHECK: t5
; CHECK-NOT: udiv
; CHECK-NEXT: [[SEL1:%.*]] = select i1 %x, i32 5, i32 6
-; CHECK-NEXT: [[SEL2:%.*]] = select i1 %y, i32 [[SEL1]], i32 %V
-; CHECK-NEXT: [[LSHR:%.*]] = lshr i32 %V, [[SEL2]]
-; CHECK-NEXT: ret i32 [[LSHR]]
+; CHECK-NEXT: [[LSHR:%.*]] = lshr i32 %V, [[SEL1]]
+; CHECK-NEXT: [[SEL2:%.*]] = select i1 %y, i32 [[LSHR]], i32 0
+; CHECK-NEXT: ret i32 [[SEL2]]
%1 = shl i32 1, %V
%2 = select i1 %x, i32 32, i32 64
%3 = select i1 %y, i32 %2, i32 %1
diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll
index b764c761cf..82d56028c3 100644
--- a/test/Transforms/InstSimplify/compare.ll
+++ b/test/Transforms/InstSimplify/compare.ll
@@ -357,6 +357,14 @@ define i1 @lshr2(i32 %x) {
; CHECK: ret i1 false
}
+define i1 @lshr3(i32 %x) {
+; CHECK: @lshr3
+ %s = lshr i32 %x, %x
+ %c = icmp eq i32 %s, 0
+ ret i1 %c
+; CHECK: ret i1 true
+}
+
define i1 @ashr1(i32 %x) {
; CHECK: @ashr1
%s = ashr i32 -1, %x
@@ -373,6 +381,14 @@ define i1 @ashr2(i32 %x) {
; CHECK: ret i1 false
}
+define i1 @ashr3(i32 %x) {
+; CHECK: @ashr3
+ %s = ashr i32 %x, %x
+ %c = icmp eq i32 %s, 0
+ ret i1 %c
+; CHECK: ret i1 true
+}
+
define i1 @select1(i1 %cond) {
; CHECK: @select1
%s = select i1 %cond, i32 1, i32 0