summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-12-09 02:52:17 +0000
committerDan Gohman <gohman@apple.com>2010-12-09 02:52:17 +0000
commitd8e0c0438ab1ec86b2bd42da7a439caa7f0a61eb (patch)
treee40cb8e64fcdfcf9e8d257ff9cea52b233d2af89 /test/Transforms
parent1a48c032bd7c240fc4c52aee6dad57f8043a77d9 (diff)
downloadllvm-d8e0c0438ab1ec86b2bd42da7a439caa7f0a61eb.tar.gz
llvm-d8e0c0438ab1ec86b2bd42da7a439caa7f0a61eb.tar.bz2
llvm-d8e0c0438ab1ec86b2bd42da7a439caa7f0a61eb.tar.xz
Really check that the bits that will become zero are actually already zero
before eliminating the operation that zeros them. This fixes rdar://8739316. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121353 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/2010-11-01-lshr-mask.ll26
1 files changed, 25 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll b/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll
index d74c70e4f7..34b165bcbe 100644
--- a/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll
+++ b/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll
@@ -1,6 +1,7 @@
; RUN: opt -instcombine -S < %s | FileCheck %s
-; <rdar://problem/8606771>
+; <rdar://problem/8606771>
+; CHECK: @main
define i32 @main(i32 %argc) nounwind ssp {
entry:
%tmp3151 = trunc i32 %argc to i8
@@ -18,3 +19,26 @@ entry:
; CHECK: ret i32
ret i32 %tmp4086
}
+
+; rdar://8739316
+; CHECK: @foo
+define i8 @foo(i8 %arg, i8 %arg1) nounwind {
+bb:
+ %tmp = shl i8 %arg, 7
+ %tmp2 = and i8 %arg1, 84
+ %tmp3 = and i8 %arg1, -118
+ %tmp4 = and i8 %arg1, 33
+ %tmp5 = sub i8 -88, %tmp2
+ %tmp6 = and i8 %tmp5, 84
+ %tmp7 = or i8 %tmp4, %tmp6
+ %tmp8 = xor i8 %tmp, %tmp3
+ %tmp9 = or i8 %tmp7, %tmp8
+ %tmp10 = lshr i8 %tmp8, 7
+ %tmp11 = shl i8 %tmp10, 5
+
+; CHECK: %0 = lshr i8 %tmp8, 2
+; CHECK: %tmp11 = and i8 %0, 32
+
+ %tmp12 = xor i8 %tmp11, %tmp9
+ ret i8 %tmp12
+}