[llvm-commits] [llvm] r92786 - in /llvm/trunk/test/Transforms/InstCombine: cast-cast-to-and.ll cast-load-gep.ll cast.ll cast_ld_addr_space.ll cast_ptr.ll
Chris Lattner
sabre at nondot.org
Tue Jan 5 13:54:10 PST 2010
Author: lattner
Date: Tue Jan 5 15:54:09 2010
New Revision: 92786
URL: http://llvm.org/viewvc/llvm-project?rev=92786&view=rev
Log:
merge some tests.
Removed:
llvm/trunk/test/Transforms/InstCombine/cast-cast-to-and.ll
llvm/trunk/test/Transforms/InstCombine/cast-load-gep.ll
llvm/trunk/test/Transforms/InstCombine/cast_ld_addr_space.ll
Modified:
llvm/trunk/test/Transforms/InstCombine/cast.ll
llvm/trunk/test/Transforms/InstCombine/cast_ptr.ll
Removed: llvm/trunk/test/Transforms/InstCombine/cast-cast-to-and.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast-cast-to-and.ll?rev=92785&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast-cast-to-and.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast-cast-to-and.ll (removed)
@@ -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
-}
-
Removed: llvm/trunk/test/Transforms/InstCombine/cast-load-gep.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast-load-gep.ll?rev=92785&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast-load-gep.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast-load-gep.ll (removed)
@@ -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 }
- at 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
-}
-
Modified: llvm/trunk/test/Transforms/InstCombine/cast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast.ll?rev=92786&r1=92785&r2=92786&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast.ll Tue Jan 5 15:54:09 2010
@@ -373,4 +373,11 @@
; 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
+}
Removed: llvm/trunk/test/Transforms/InstCombine/cast_ld_addr_space.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast_ld_addr_space.ll?rev=92785&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast_ld_addr_space.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast_ld_addr_space.ll (removed)
@@ -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
Modified: llvm/trunk/test/Transforms/InstCombine/cast_ptr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast_ptr.ll?rev=92786&r1=92785&r2=92786&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast_ptr.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast_ptr.ll Tue Jan 5 15:54:09 2010
@@ -45,3 +45,35 @@
; 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 }
+ at 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
+}
More information about the llvm-commits
mailing list