1 ; RUN: opt < %s -inline -S | FileCheck %s
3 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
4 target triple = "powerpc64-unknown-linux-gnu"
6 %struct.s = type { i32, i32 }
8 define void @foo(%struct.s* byval nocapture readonly %a) {
10 %x = alloca [2 x i32], align 4
11 %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0
12 %0 = load i32, i32* %a1, align 4
13 %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0
14 store i32 %0, i32* %arrayidx, align 4
15 %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1
16 %1 = load i32, i32* %b, align 4
17 %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1
18 store i32 %1, i32* %arrayidx2, align 4
19 call void @bar(i32* %arrayidx) #2
23 define void @foo0(%struct.s* byval nocapture readonly %a) {
26 %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0
27 %0 = load i32, i32* %a1, align 4
28 %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0
29 store i32 %0, i32* %arrayidx, align 4
30 %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1
31 %1 = load i32, i32* %b, align 4
32 %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1
33 store i32 %1, i32* %arrayidx2, align 4
34 call void @bar(i32* %arrayidx) #2
38 define void @foo1(%struct.s* byval nocapture readonly %a) {
40 %x = alloca [2 x i32], align 1
41 %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0
42 %0 = load i32, i32* %a1, align 4
43 %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0
44 store i32 %0, i32* %arrayidx, align 4
45 %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1
46 %1 = load i32, i32* %b, align 4
47 %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1
48 store i32 %1, i32* %arrayidx2, align 4
49 call void @bar(i32* %arrayidx) #2
53 declare void @bar(i32*) #1
55 define void @goo(%struct.s* byval nocapture readonly %a) {
57 %x = alloca [2 x i32], align 32
58 %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0
59 %0 = load i32, i32* %a1, align 4
60 %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0
61 store i32 %0, i32* %arrayidx, align 32
62 %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1
63 %1 = load i32, i32* %b, align 4
64 %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1
65 store i32 %1, i32* %arrayidx2, align 4
66 call void @bar(i32* %arrayidx) #2
71 ; CHECK: alloca [2 x i32], align 32
72 ; CHECK-NOT: alloca [2 x i32]
75 define signext i32 @main() {
77 %a = alloca i64, align 8
78 %tmpcast = bitcast i64* %a to %struct.s*
79 store i64 0, i64* %a, align 8
80 %a1 = bitcast i64* %a to i32*
81 store i32 1, i32* %a1, align 8
82 call void @foo(%struct.s* byval %tmpcast)
83 store i32 2, i32* %a1, align 8
84 call void @goo(%struct.s* byval %tmpcast)
89 ; CHECK: alloca [2 x i32], align 32
90 ; CHECK-NOT: alloca [2 x i32]
93 define signext i32 @test0() {
95 %a = alloca i64, align 8
96 %tmpcast = bitcast i64* %a to %struct.s*
97 store i64 0, i64* %a, align 8
98 %a1 = bitcast i64* %a to i32*
99 store i32 1, i32* %a1, align 8
100 call void @foo0(%struct.s* byval %tmpcast)
101 store i32 2, i32* %a1, align 8
102 call void @goo(%struct.s* byval %tmpcast)