aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-29 00:51:17 +0000
committerChris Lattner <sabre@nondot.org>2009-11-29 00:51:17 +0000
commit3f40e233922dfecb10cb7e4996f800cd35a93271 (patch)
treeccd7bc53eaaae6eceb1fa33c18c2186ba4b351a5 /test/Transforms/InstCombine
parentd801c10de6cd1760f0994452c0e78156782d9fca (diff)
downloadexternal_llvm-3f40e233922dfecb10cb7e4996f800cd35a93271.zip
external_llvm-3f40e233922dfecb10cb7e4996f800cd35a93271.tar.gz
external_llvm-3f40e233922dfecb10cb7e4996f800cd35a93271.tar.bz2
Implement PR5634.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r--test/Transforms/InstCombine/or.ll44
1 files changed, 43 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/or.ll b/test/Transforms/InstCombine/or.ll
index b72480b..4a14081 100644
--- a/test/Transforms/InstCombine/or.ll
+++ b/test/Transforms/InstCombine/or.ll
@@ -1,7 +1,8 @@
; This test makes sure that these instructions are properly eliminated.
-;
; RUN: opt < %s -instcombine -S | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+
define i32 @test1(i32 %A) {
%B = or i32 %A, 0
ret i32 %B
@@ -253,3 +254,44 @@ define i1 @test25(i32 %A, i32 %B) {
; CHECK-NEXT: %F = and i1
; CHECK-NEXT: ret i1 %F
}
+
+; PR5634
+define i1 @test26(i32 %A, i32 %B) {
+ %C1 = icmp eq i32 %A, 0
+ %C2 = icmp eq i32 %B, 0
+ ; (A == 0) & (A == 0) --> (A|B) == 0
+ %D = and i1 %C1, %C2
+ ret i1 %D
+; CHECK: @test26
+; CHECK: or i32 %A, %B
+; CHECK: icmp eq i32 {{.*}}, 0
+; CHECK: ret i1
+}
+
+; PR5634
+define i1 @test27(i32* %A, i32* %B) {
+ %C1 = icmp eq i32* %A, null
+ %C2 = icmp eq i32* %B, null
+ ; (A == 0) & (A == 0) --> (A|B) == 0
+ %D = and i1 %C1, %C2
+ ret i1 %D
+; CHECK: @test27
+; CHECK: ptrtoint i32* %A
+; CHECK: ptrtoint i32* %B
+; CHECK: or i32
+; CHECK: icmp eq i32 {{.*}}, 0
+; CHECK: ret i1
+}
+
+; PR5634
+define i1 @test28(i32 %A, i32 %B) {
+ %C1 = icmp ne i32 %A, 0
+ %C2 = icmp ne i32 %B, 0
+ ; (A != 0) | (A != 0) --> (A|B) != 0
+ %D = or i1 %C1, %C2
+ ret i1 %D
+; CHECK: @test28
+; CHECK: or i32 %A, %B
+; CHECK: icmp ne i32 {{.*}}, 0
+; CHECK: ret i1
+}