merge some tests.
authorChris Lattner <sabre@nondot.org>
Tue, 5 Jan 2010 21:54:09 +0000 (21:54 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 5 Jan 2010 21:54:09 +0000 (21:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92786 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/cast-cast-to-and.ll [deleted file]
test/Transforms/InstCombine/cast-load-gep.ll [deleted file]
test/Transforms/InstCombine/cast.ll
test/Transforms/InstCombine/cast_ld_addr_space.ll [deleted file]
test/Transforms/InstCombine/cast_ptr.ll

diff --git a/test/Transforms/InstCombine/cast-cast-to-and.ll b/test/Transforms/InstCombine/cast-cast-to-and.ll
deleted file mode 100644 (file)
index 1e591cc..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-; RUN: opt < %s -instcombine -S | \
-; RUN:   not grep i8 
-
-define i32 @test1(i32 %X) {
-        %Y = trunc i32 %X to i8         ; <i8> [#uses=1]
-        %Z = zext i8 %Y to i32          ; <i32> [#uses=1]
-        ret i32 %Z
-}
-
diff --git a/test/Transforms/InstCombine/cast-load-gep.ll b/test/Transforms/InstCombine/cast-load-gep.ll
deleted file mode 100644 (file)
index 271c737..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-; RUN: opt < %s -instcombine -globaldce -S | \
-; RUN:   not grep Array
-target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
-
-; Pulling the cast out of the load allows us to eliminate the load, and then 
-; the whole array.
-
-        %op = type { float }
-        %unop = type { i32 }
-@Array = internal constant [1 x %op* (%op*)*] [ %op* (%op*)* @foo ]             ; <[1 x %op* (%op*)*]*> [#uses=1]
-
-define %op* @foo(%op* %X) {
-        ret %op* %X
-}
-
-define %unop* @caller(%op* %O) {
-        %tmp = load %unop* (%op*)** bitcast ([1 x %op* (%op*)*]* @Array to %unop* (%op*)**); <%unop* (%op*)*> [#uses=1]
-        %tmp.2 = call %unop* %tmp( %op* %O )            ; <%unop*> [#uses=1]
-        ret %unop* %tmp.2
-}
-
index 5bcfded872ce00a80f2b7a798f10a3bc23d56004..3c2f28116e3fb1df7886f44e58c8984743c159fc 100644 (file)
@@ -373,4 +373,11 @@ define i32* @test41(i32* %tmp1) {
 ; CHECK: ret i32* %tmp1
 }
 
+define i32 @test42(i32 %X) {
+        %Y = trunc i32 %X to i8         ; <i8> [#uses=1]
+        %Z = zext i8 %Y to i32          ; <i32> [#uses=1]
+        ret i32 %Z
+; CHECK: @test42
+; CHECK: %Z = and i32 %X, 255
+}
 
diff --git a/test/Transforms/InstCombine/cast_ld_addr_space.ll b/test/Transforms/InstCombine/cast_ld_addr_space.ll
deleted file mode 100644 (file)
index e94dce7..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-; RUN: opt < %s -instcombine -S | grep bitcast | count 1
-
-; InstCombine can not 'load (cast P)' -> cast (load P)' if the cast changes
-; the address space.
-
-
-define void @test2(i8 addrspace(1)* %source, <2 x i8> addrspace(1)* %dest) {                                                                                        
-entry: 
-  %arrayidx1 = bitcast <2 x i8> addrspace(1)* %dest to <2 x i8> addrspace(1)*
-  %conv = bitcast i8 addrspace(1)* %source to <16 x i8>*
-  %arrayidx22 = bitcast <16 x i8>* %conv to <16 x i8>*
-  %tmp3 = load <16 x i8>* %arrayidx22
-  %arrayidx223 = bitcast i8 addrspace(1)* %source to i8*
-  %tmp4 = load i8* %arrayidx223
-  %tmp5 = insertelement <2 x i8> undef, i8 %tmp4, i32 0
-  %splat = shufflevector <2 x i8> %tmp5, <2 x i8> undef, <2 x i32> zeroinitializer
-  store <2 x i8> %splat, <2 x i8> addrspace(1)* %arrayidx1
-  ret void                                                                                                                                                             
-} 
\ No newline at end of file
index 5160af006ec027842370b156ba0e117f35e68ad2..09910fbc848167538381a789588e1eb87ea00d94 100644 (file)
@@ -45,3 +45,35 @@ define i1 @test4(i32 %A) {
 ; CHECK-NEXT: %C = icmp eq i32 %A, 0
 ; CHECK-NEXT: ret i1 %C 
 }
+
+
+; Pulling the cast out of the load allows us to eliminate the load, and then 
+; the whole array.
+
+        %op = type { float }
+        %unop = type { i32 }
+@Array = internal constant [1 x %op* (%op*)*] [ %op* (%op*)* @foo ]             ; <[1 x %op* (%op*)*]*> [#uses=1]
+
+declare %op* @foo(%op* %X)
+
+define %unop* @test5(%op* %O) {
+        %tmp = load %unop* (%op*)** bitcast ([1 x %op* (%op*)*]* @Array to %unop* (%op*)**); <%unop* (%op*)*> [#uses=1]
+        %tmp.2 = call %unop* %tmp( %op* %O )            ; <%unop*> [#uses=1]
+        ret %unop* %tmp.2
+; CHECK: @test5
+; CHECK: call %op* @foo(%op* %O)
+}
+
+
+
+; InstCombine can not 'load (cast P)' -> cast (load P)' if the cast changes
+; the address space.
+
+define i8 @test6(i8 addrspace(1)* %source) {                                                                                        
+entry: 
+  %arrayidx223 = bitcast i8 addrspace(1)* %source to i8*
+  %tmp4 = load i8* %arrayidx223
+  ret i8 %tmp4
+; CHECK: @test6
+; CHECK: load i8* %arrayidx223
+}