1 ; RUN: llc -march=mipsel -mcpu=4ke < %s | FileCheck %s
3 define i32 @twoalloca(i32 %size) nounwind {
5 ; CHECK: subu $[[T0:[0-9]+]], $sp, $[[SZ:[0-9]+]]
6 ; CHECK: addu $sp, $zero, $[[T0]]
7 ; CHECK: addiu $[[T1:[0-9]+]], $sp, [[OFF:[0-9]+]]
8 ; CHECK: subu $[[T2:[0-9]+]], $sp, $[[SZ]]
9 ; CHECK: addu $sp, $zero, $[[T2]]
10 ; CHECK: addiu $[[T3:[0-9]+]], $sp, [[OFF]]
11 ; CHECK: lw $25, %call16(foo)($gp)
12 ; CHECK: addu $4, $zero, $[[T1]]
14 ; CHECK: lw $25, %call16(foo)($gp)
15 ; CHECK: addu $4, $zero, $[[T3]]
17 %tmp1 = alloca i8, i32 %size, align 4
18 %add.ptr = getelementptr inbounds i8* %tmp1, i32 5
19 store i8 97, i8* %add.ptr, align 1
20 %tmp4 = alloca i8, i32 %size, align 4
21 call void @foo2(double 1.000000e+00, double 2.000000e+00, i32 3) nounwind
22 %call = call i32 @foo(i8* %tmp1) nounwind
23 %call7 = call i32 @foo(i8* %tmp4) nounwind
24 %add = add nsw i32 %call7, %call
28 declare void @foo2(double, double, i32)
32 @.str = private unnamed_addr constant [22 x i8] c"%d %d %d %d %d %d %d\0A\00", align 1
34 define i32 @alloca2(i32 %size) nounwind {
36 ; dynamic allocated stack area and $gp restore slot have the same offsets
40 ; CHECK: .cprestore [[OFF:[0-9]+]]
41 ; CHECK: subu $[[T0:[0-9]+]], $sp, $[[SZ:[0-9]+]]
42 ; CHECK: addu $sp, $zero, $[[T0]]
43 ; CHECK: addiu $[[T1:[0-9]+]], $sp, [[OFF]]
45 %tmp1 = alloca i8, i32 %size, align 4
46 %0 = bitcast i8* %tmp1 to i32*
47 %cmp = icmp sgt i32 %size, 10
48 br i1 %cmp, label %if.then, label %if.else
50 if.then: ; preds = %entry
51 ; CHECK: addiu $4, $[[T1]], 40
53 %add.ptr = getelementptr inbounds i8* %tmp1, i32 40
54 %1 = bitcast i8* %add.ptr to i32*
55 call void @foo3(i32* %1) nounwind
56 %arrayidx15.pre = getelementptr inbounds i8* %tmp1, i32 12
57 %.pre = bitcast i8* %arrayidx15.pre to i32*
60 if.else: ; preds = %entry
61 ; CHECK: addiu $4, $[[T1]], 12
63 %add.ptr5 = getelementptr inbounds i8* %tmp1, i32 12
64 %2 = bitcast i8* %add.ptr5 to i32*
65 call void @foo3(i32* %2) nounwind
68 if.end: ; preds = %if.else, %if.then
69 ; CHECK: lw $5, 0($[[T1]])
70 ; CHECK: lw $25, %call16(printf)
72 %.pre-phi = phi i32* [ %2, %if.else ], [ %.pre, %if.then ]
73 %tmp7 = load i32* %0, align 4, !tbaa !0
74 %arrayidx9 = getelementptr inbounds i8* %tmp1, i32 4
75 %3 = bitcast i8* %arrayidx9 to i32*
76 %tmp10 = load i32* %3, align 4, !tbaa !0
77 %arrayidx12 = getelementptr inbounds i8* %tmp1, i32 8
78 %4 = bitcast i8* %arrayidx12 to i32*
79 %tmp13 = load i32* %4, align 4, !tbaa !0
80 %tmp16 = load i32* %.pre-phi, align 4, !tbaa !0
81 %arrayidx18 = getelementptr inbounds i8* %tmp1, i32 16
82 %5 = bitcast i8* %arrayidx18 to i32*
83 %tmp19 = load i32* %5, align 4, !tbaa !0
84 %arrayidx21 = getelementptr inbounds i8* %tmp1, i32 20
85 %6 = bitcast i8* %arrayidx21 to i32*
86 %tmp22 = load i32* %6, align 4, !tbaa !0
87 %arrayidx24 = getelementptr inbounds i8* %tmp1, i32 24
88 %7 = bitcast i8* %arrayidx24 to i32*
89 %tmp25 = load i32* %7, align 4, !tbaa !0
90 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([22 x i8]* @.str, i32 0, i32 0), i32 %tmp7, i32 %tmp10, i32 %tmp13, i32 %tmp16, i32 %tmp19, i32 %tmp22, i32 %tmp25) nounwind
94 declare void @foo3(i32*)
96 declare i32 @printf(i8* nocapture, ...) nounwind
98 !0 = metadata !{metadata !"int", metadata !1}
99 !1 = metadata !{metadata !"omnipotent char", metadata !2}
100 !2 = metadata !{metadata !"Simple C/C++ TBAA", null}