1 ; RUN: llc -march=hexagon -mtriple=hexagon-unknown-linux-musl < %s | FileCheck %s
3 ; Check that we update the stack pointer before we do allocframe, so that
4 ; the LR/FP are stored in the location required by the Linux ABI.
5 ; CHECK: r29 = add(r29,#-24)
8 target triple = "hexagon-unknown-linux"
10 %s.0 = type { i8*, i8*, i8* }
12 define dso_local i32 @f0(i32 %a0, ...) local_unnamed_addr #0 {
14 %v0 = alloca [1 x %s.0], align 8
15 %v1 = bitcast [1 x %s.0]* %v0 to i8*
16 call void @llvm.lifetime.start.p0i8(i64 12, i8* nonnull %v1) #2
17 call void @llvm.va_start(i8* nonnull %v1)
18 %v2 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 0
19 %v3 = load i8*, i8** %v2, align 8
20 %v4 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 1
21 %v5 = load i8*, i8** %v4, align 4
22 %v6 = getelementptr i8, i8* %v3, i32 4
23 %v7 = icmp sgt i8* %v6, %v5
24 br i1 %v7, label %b1, label %b2
27 %v8 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 2
28 %v9 = load i8*, i8** %v8, align 8
29 %v10 = getelementptr i8, i8* %v9, i32 4
30 store i8* %v10, i8** %v8, align 8
33 b2: ; preds = %b1, %b0
34 %v11 = phi i8* [ %v10, %b1 ], [ %v6, %b0 ]
35 %v12 = phi i8* [ %v9, %b1 ], [ %v3, %b0 ]
36 %v13 = bitcast i8* %v12 to i32*
37 store i8* %v11, i8** %v2, align 8
38 %v14 = load i32, i32* %v13, align 4
39 %v15 = icmp eq i32 %v14, 0
40 br i1 %v15, label %b7, label %b3
43 %v16 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 2
46 b4: ; preds = %b6, %b3
47 %v17 = phi i32 [ %v14, %b3 ], [ %v28, %b6 ]
48 %v18 = phi i32 [ %a0, %b3 ], [ %v20, %b6 ]
49 %v19 = phi i8* [ %v11, %b3 ], [ %v25, %b6 ]
50 %v20 = add nsw i32 %v17, %v18
51 %v21 = getelementptr i8, i8* %v19, i32 4
52 %v22 = icmp sgt i8* %v21, %v5
53 br i1 %v22, label %b5, label %b6
56 %v23 = load i8*, i8** %v16, align 8
57 %v24 = getelementptr i8, i8* %v23, i32 4
58 store i8* %v24, i8** %v16, align 8
61 b6: ; preds = %b5, %b4
62 %v25 = phi i8* [ %v24, %b5 ], [ %v21, %b4 ]
63 %v26 = phi i8* [ %v23, %b5 ], [ %v19, %b4 ]
64 %v27 = bitcast i8* %v26 to i32*
65 store i8* %v25, i8** %v2, align 8
66 %v28 = load i32, i32* %v27, align 4
67 %v29 = icmp eq i32 %v28, 0
68 br i1 %v29, label %b7, label %b4
70 b7: ; preds = %b6, %b2
71 %v30 = phi i32 [ %a0, %b2 ], [ %v20, %b6 ]
72 call void @llvm.va_end(i8* nonnull %v1)
73 call void @llvm.lifetime.end.p0i8(i64 12, i8* nonnull %v1) #2
77 ; Function Attrs: argmemonly nounwind
78 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
80 ; Function Attrs: nounwind
81 declare void @llvm.va_start(i8*) #2
83 ; Function Attrs: nounwind
84 declare void @llvm.va_end(i8*) #2
86 ; Function Attrs: argmemonly nounwind
87 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
89 attributes #0 = { argmemonly nounwind "frame-pointer"="all" }
91 !llvm.module.flags = !{!0}
93 !0 = !{i32 1, !"wchar_size", i32 4}