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 %idxprom = sext i32 %a to i64
13 %arrayidx = getelementptr inbounds [128 x i32], ptr %stack, i64 0, i64 %idxprom
14 store i32 %b, ptr %arrayidx, align 4
15 %0 = load volatile i32, ptr @bar, align 4
16 %1 = load volatile i32, ptr @bar, align 4
17 %2 = load volatile i32, ptr @bar, align 4
18 %3 = load volatile i32, ptr @bar, align 4
19 %4 = load volatile i32, ptr @bar, align 4
20 %5 = load volatile i32, ptr @bar, align 4
21 %6 = load volatile i32, ptr @bar, align 4
22 %7 = load volatile i32, ptr @bar, align 4
23 %8 = load volatile i32, ptr @bar, align 4
24 %9 = load volatile i32, ptr @bar, align 4
25 %10 = load volatile i32, ptr @bar, align 4
26 %11 = load volatile i32, ptr @bar, align 4
27 %12 = load volatile i32, ptr @bar, align 4
28 %13 = load volatile i32, ptr @bar, align 4
29 %14 = load volatile i32, ptr @bar, align 4
30 %15 = load volatile i32, ptr @bar, align 4
31 %16 = load volatile i32, ptr @bar, align 4
32 %17 = load volatile i32, ptr @bar, align 4
33 %18 = load volatile i32, ptr @bar, align 4
34 %19 = load volatile i32, ptr @bar, align 4
35 %idxprom1 = sext i32 %c to i64
36 %arrayidx2 = getelementptr inbounds [128 x i32], ptr %stack, i64 0, i64 %idxprom1
37 %20 = load i32, ptr %arrayidx2, align 4
38 %factor = mul i32 %h, -2
39 %factor67 = mul i32 %g, -2
40 %factor68 = mul i32 %f, -2
41 %factor69 = mul i32 %e, -2
42 %factor70 = mul i32 %d, -2
43 %factor71 = mul i32 %c, -2
44 %factor72 = mul i32 %b, -2
46 %sum73 = add i32 %sum, %2
47 %sum74 = add i32 %sum73, %3
48 %sum75 = add i32 %sum74, %4
49 %sum76 = add i32 %sum75, %5
50 %sum77 = add i32 %sum76, %6
51 %sum78 = add i32 %sum77, %7
52 %sum79 = add i32 %sum78, %8
53 %sum80 = add i32 %sum79, %9
54 %sum81 = add i32 %sum80, %10
55 %sum82 = add i32 %sum81, %11
56 %sum83 = add i32 %sum82, %12
57 %sum84 = add i32 %sum83, %13
58 %sum85 = add i32 %sum84, %14
59 %sum86 = add i32 %sum85, %15
60 %sum87 = add i32 %sum86, %16
61 %sum88 = add i32 %sum87, %17
62 %sum89 = add i32 %sum88, %18
63 %sum90 = add i32 %sum89, %19
64 %sub15 = sub i32 %20, %sum90
65 %sub16 = add i32 %sub15, %factor
66 %sub17 = add i32 %sub16, %factor67
67 %sub18 = add i32 %sub17, %factor68
68 %sub19 = add i32 %sub18, %factor69
69 %sub20 = add i32 %sub19, %factor70
70 %sub21 = add i32 %sub20, %factor71
71 %add = add i32 %sub21, %factor72