1 ; RUN: llc -mtriple=arm64-apple-ios < %s
2 @bar = common global i32 0, align 4
4 ; Leaf function which uses all callee-saved registers and allocates >= 256 bytes
5 ; on the stack this will cause determineCalleeSaves() to spill LR as an
6 ; additional scratch register.
8 ; This is a crash-only regression test for rdar://15124582.
9 define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 %h) nounwind {
11 %stack = alloca [128 x i32], align 4
12 %0 = bitcast [128 x i32]* %stack to i8*
13 %idxprom = sext i32 %a to i64
14 %arrayidx = getelementptr inbounds [128 x i32], [128 x i32]* %stack, i64 0, i64 %idxprom
15 store i32 %b, i32* %arrayidx, align 4
16 %1 = load volatile i32, i32* @bar, align 4
17 %2 = load volatile i32, i32* @bar, align 4
18 %3 = load volatile i32, i32* @bar, align 4
19 %4 = load volatile i32, i32* @bar, align 4
20 %5 = load volatile i32, i32* @bar, align 4
21 %6 = load volatile i32, i32* @bar, align 4
22 %7 = load volatile i32, i32* @bar, align 4
23 %8 = load volatile i32, i32* @bar, align 4
24 %9 = load volatile i32, i32* @bar, align 4
25 %10 = load volatile i32, i32* @bar, align 4
26 %11 = load volatile i32, i32* @bar, align 4
27 %12 = load volatile i32, i32* @bar, align 4
28 %13 = load volatile i32, i32* @bar, align 4
29 %14 = load volatile i32, i32* @bar, align 4
30 %15 = load volatile i32, i32* @bar, align 4
31 %16 = load volatile i32, i32* @bar, align 4
32 %17 = load volatile i32, i32* @bar, align 4
33 %18 = load volatile i32, i32* @bar, align 4
34 %19 = load volatile i32, i32* @bar, align 4
35 %20 = load volatile i32, i32* @bar, align 4
36 %idxprom1 = sext i32 %c to i64
37 %arrayidx2 = getelementptr inbounds [128 x i32], [128 x i32]* %stack, i64 0, i64 %idxprom1
38 %21 = load i32, i32* %arrayidx2, align 4
39 %factor = mul i32 %h, -2
40 %factor67 = mul i32 %g, -2
41 %factor68 = mul i32 %f, -2
42 %factor69 = mul i32 %e, -2
43 %factor70 = mul i32 %d, -2
44 %factor71 = mul i32 %c, -2
45 %factor72 = mul i32 %b, -2
47 %sum73 = add i32 %sum, %3
48 %sum74 = add i32 %sum73, %4
49 %sum75 = add i32 %sum74, %5
50 %sum76 = add i32 %sum75, %6
51 %sum77 = add i32 %sum76, %7
52 %sum78 = add i32 %sum77, %8
53 %sum79 = add i32 %sum78, %9
54 %sum80 = add i32 %sum79, %10
55 %sum81 = add i32 %sum80, %11
56 %sum82 = add i32 %sum81, %12
57 %sum83 = add i32 %sum82, %13
58 %sum84 = add i32 %sum83, %14
59 %sum85 = add i32 %sum84, %15
60 %sum86 = add i32 %sum85, %16
61 %sum87 = add i32 %sum86, %17
62 %sum88 = add i32 %sum87, %18
63 %sum89 = add i32 %sum88, %19
64 %sum90 = add i32 %sum89, %20
65 %sub15 = sub i32 %21, %sum90
66 %sub16 = add i32 %sub15, %factor
67 %sub17 = add i32 %sub16, %factor67
68 %sub18 = add i32 %sub17, %factor68
69 %sub19 = add i32 %sub18, %factor69
70 %sub20 = add i32 %sub19, %factor70
71 %sub21 = add i32 %sub20, %factor71
72 %add = add i32 %sub21, %factor72