Modify two Transforms tests to explicitly check for full function names in some cases...
[oota-llvm.git] / test / Transforms / ScalarRepl / badarray.ll
1 ; RUN: opt < %s -scalarrepl -S | FileCheck %s
2
3 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:32:32-n8:16:32"
4 target triple = "i386-pc-linux-gnu"
5
6
7 ; PR3466
8 ; Off end of array, don't transform.
9 define i32 @test1() {
10 ; CHECK: @test1
11 ; CHECK-NOT: = alloca
12         %X = alloca [4 x i32]
13         %Y = getelementptr [4 x i32]* %X, i64 0, i64 6          ; <i32*> [#uses=2]
14         store i32 0, i32* %Y
15         %Z = load i32* %Y               ; <i32> [#uses=1]
16         ret i32 %Z
17 }
18
19
20 ; Off end of array, don't transform.
21 define i32 @test2() nounwind {
22 entry:
23 ; CHECK: @test2
24 ; CHECK-NOT: = alloca
25         %yx2.i = alloca float, align 4          ; <float*> [#uses=1]            
26         %yx26.i = bitcast float* %yx2.i to i64*         ; <i64*> [#uses=1]      
27         %0 = load i64* %yx26.i, align 8         ; <i64> [#uses=0]               
28         unreachable
29 }
30
31 %base = type { i32, [0 x i8] }
32 %padded = type { %base, [1 x i32] }
33
34 ; PR5436
35 define void @test3() {
36 entry:
37 ; CHECK: @test3
38 ; CHECK-NOT: = alloca
39 ; CHECK: store i64
40   %var_1 = alloca %padded, align 8                ; <%padded*> [#uses=3]
41   %0 = getelementptr inbounds %padded* %var_1, i32 0, i32 0 ; <%base*> [#uses=2]
42   
43   %p2 = getelementptr inbounds %base* %0, i32 0, i32 1, i32 0 ; <i8*> [#uses=1]
44   store i8 72, i8* %p2, align 1
45   
46   ; 72 -> a[0].
47
48   %callret = call %padded *@test3f() ; <i32> [#uses=2]
49   %callretcast = bitcast %padded* %callret to i8*                     ; <i8*> [#uses=1]
50   %var_11 = bitcast %padded* %var_1 to i8*        ; <i8*> [#uses=1]
51   call void @llvm.memcpy.p0i8.p0i8.i32(i8* %callretcast, i8* %var_11, i32 8, i32 4, i1 false)
52   ret void
53 }
54
55 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
56
57 declare %padded* @test3f()