1; RUN: llc -march=mipsel -relocation-model=pic < %s | FileCheck %s 2 3define i32 @twoalloca(i32 %size) nounwind { 4entry: 5; CHECK: subu $[[T0:[0-9]+]], $sp, $[[SZ:[0-9]+]] 6; CHECK: move $sp, $[[T0]] 7; CHECK: subu $[[T2:[0-9]+]], $sp, $[[SZ]] 8; CHECK: move $sp, $[[T2]] 9; CHECK: move $4, $[[T0]] 10; CHECK: move $4, $[[T2]] 11 %tmp1 = alloca i8, i32 %size, align 4 12 %add.ptr = getelementptr inbounds i8, i8* %tmp1, i32 5 13 store i8 97, i8* %add.ptr, align 1 14 %tmp4 = alloca i8, i32 %size, align 4 15 call void @foo2(double 1.000000e+00, double 2.000000e+00, i32 3) nounwind 16 %call = call i32 @foo(i8* %tmp1) nounwind 17 %call7 = call i32 @foo(i8* %tmp4) nounwind 18 %add = add nsw i32 %call7, %call 19 ret i32 %add 20} 21 22declare void @foo2(double, double, i32) 23 24declare i32 @foo(i8*) 25 26@.str = private unnamed_addr constant [22 x i8] c"%d %d %d %d %d %d %d\0A\00", align 1 27 28define i32 @alloca2(i32 %size) nounwind { 29entry: 30; CHECK: alloca2 31; CHECK: subu $[[T0:[0-9]+]], $sp 32; CHECK: move $sp, $[[T0]] 33 34 %tmp1 = alloca i8, i32 %size, align 4 35 %0 = bitcast i8* %tmp1 to i32* 36 %cmp = icmp sgt i32 %size, 10 37 br i1 %cmp, label %if.then, label %if.else 38 39if.then: ; preds = %entry 40; CHECK: addiu $4, $[[T0]], 40 41 42 %add.ptr = getelementptr inbounds i8, i8* %tmp1, i32 40 43 %1 = bitcast i8* %add.ptr to i32* 44 call void @foo3(i32* %1) nounwind 45 %arrayidx15.pre = getelementptr inbounds i8, i8* %tmp1, i32 12 46 %.pre = bitcast i8* %arrayidx15.pre to i32* 47 br label %if.end 48 49if.else: ; preds = %entry 50; CHECK: addiu $4, $[[T0]], 12 51 52 %add.ptr5 = getelementptr inbounds i8, i8* %tmp1, i32 12 53 %2 = bitcast i8* %add.ptr5 to i32* 54 call void @foo3(i32* %2) nounwind 55 br label %if.end 56 57if.end: ; preds = %if.else, %if.then 58; CHECK: lw $5, 0($[[T0]]) 59; CHECK: lw $25, %call16(printf) 60 61 %.pre-phi = phi i32* [ %2, %if.else ], [ %.pre, %if.then ] 62 %tmp7 = load i32, i32* %0, align 4 63 %arrayidx9 = getelementptr inbounds i8, i8* %tmp1, i32 4 64 %3 = bitcast i8* %arrayidx9 to i32* 65 %tmp10 = load i32, i32* %3, align 4 66 %arrayidx12 = getelementptr inbounds i8, i8* %tmp1, i32 8 67 %4 = bitcast i8* %arrayidx12 to i32* 68 %tmp13 = load i32, i32* %4, align 4 69 %tmp16 = load i32, i32* %.pre-phi, align 4 70 %arrayidx18 = getelementptr inbounds i8, i8* %tmp1, i32 16 71 %5 = bitcast i8* %arrayidx18 to i32* 72 %tmp19 = load i32, i32* %5, align 4 73 %arrayidx21 = getelementptr inbounds i8, i8* %tmp1, i32 20 74 %6 = bitcast i8* %arrayidx21 to i32* 75 %tmp22 = load i32, i32* %6, align 4 76 %arrayidx24 = getelementptr inbounds i8, i8* %tmp1, i32 24 77 %7 = bitcast i8* %arrayidx24 to i32* 78 %tmp25 = load i32, i32* %7, align 4 79 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i32 0, i32 0), i32 %tmp7, i32 %tmp10, i32 %tmp13, i32 %tmp16, i32 %tmp19, i32 %tmp22, i32 %tmp25) nounwind 80 ret i32 0 81} 82 83declare void @foo3(i32*) 84 85declare i32 @printf(i8* nocapture, ...) nounwind 86