1 ; RUN: opt < %s -inline -S | FileCheck %s
2 ; This variant of the test has no data layout information.
3 target triple = "powerpc64-unknown-linux-gnu"
5 %struct.s = type { i32, i32 }
7 define void @foo(%struct.s* byval nocapture readonly %a) {
9 %x = alloca [2 x i32], align 4
10 %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0
11 %0 = load i32, i32* %a1, align 4
12 %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0
13 store i32 %0, i32* %arrayidx, align 4
14 %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1
15 %1 = load i32, i32* %b, align 4
16 %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1
17 store i32 %1, i32* %arrayidx2, align 4
18 call void @bar(i32* %arrayidx) #2
22 define void @foo0(%struct.s* byval nocapture readonly %a) {
25 %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0
26 %0 = load i32, i32* %a1, align 4
27 %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0
28 store i32 %0, i32* %arrayidx, align 4
29 %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1
30 %1 = load i32, i32* %b, align 4
31 %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1
32 store i32 %1, i32* %arrayidx2, align 4
33 call void @bar(i32* %arrayidx) #2
37 declare void @bar(i32*) #1
39 define void @goo(%struct.s* byval nocapture readonly %a) {
41 %x = alloca [2 x i32], align 32
42 %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0
43 %0 = load i32, i32* %a1, align 4
44 %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0
45 store i32 %0, i32* %arrayidx, align 32
46 %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1
47 %1 = load i32, i32* %b, align 4
48 %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1
49 store i32 %1, i32* %arrayidx2, align 4
50 call void @bar(i32* %arrayidx) #2
55 ; CHECK: alloca [2 x i32], align 32
56 ; CHECK-NOT: alloca [2 x i32]
59 define signext i32 @main() {
61 %a = alloca i64, align 8
62 %tmpcast = bitcast i64* %a to %struct.s*
63 store i64 0, i64* %a, align 8
64 %a1 = bitcast i64* %a to i32*
65 store i32 1, i32* %a1, align 8
66 call void @foo(%struct.s* byval %tmpcast)
67 store i32 2, i32* %a1, align 8
68 call void @goo(%struct.s* byval %tmpcast)
73 ; CHECK: alloca [2 x i32], align 32
74 ; CHECK: alloca [2 x i32]
77 define signext i32 @test0() {
79 %a = alloca i64, align 8
80 %tmpcast = bitcast i64* %a to %struct.s*
81 store i64 0, i64* %a, align 8
82 %a1 = bitcast i64* %a to i32*
83 store i32 1, i32* %a1, align 8
84 call void @foo0(%struct.s* byval %tmpcast)
85 store i32 2, i32* %a1, align 8
86 call void @goo(%struct.s* byval %tmpcast)