1 ; RUN: llc -march=hexagon < %s | FileCheck %s
3 ; Make sure that if there's only one store to the stack, it gets packetized
4 ; with allocframe as there's a latency of 2 cycles between allocframe and
5 ; the following store if not in the same packet.
12 ; CHECK: = memw(gp+#G)
14 %struct.0 = type { ptr, i32, %struct.2 }
15 %struct.1 = type { i32, i32, [31 x i8] }
16 %struct.2 = type { %struct.1 }
18 @G = common global ptr null, align 4
20 define i32 @test(ptr nocapture %a0) #0 {
22 %v2 = alloca ptr, align 4
23 %v5 = load ptr, ptr %a0, align 4
24 store ptr %v5, ptr %v2, align 4
25 %v7 = load ptr, ptr @G, align 4
26 tail call void @llvm.memcpy.p0.p0.i32(ptr align 4 %v5, ptr align 4 %v7, i32 48, i1 false)
27 %v8 = getelementptr inbounds %struct.0, ptr %a0, i32 0, i32 2, i32 0, i32 1
28 store i32 5, ptr %v8, align 4
29 %v9 = getelementptr inbounds %struct.0, ptr %v5, i32 0, i32 2, i32 0, i32 1
30 store i32 5, ptr %v9, align 4
31 %v11 = load i32, ptr %a0, align 4
32 store i32 %v11, ptr %v5, align 4
33 %v13 = call i32 @f0(ptr nonnull %v2)
34 %v14 = load ptr, ptr %v2, align 4
35 %v15 = getelementptr inbounds %struct.0, ptr %v14, i32 0, i32 1
36 %v16 = load i32, ptr %v15, align 4
37 %v17 = icmp eq i32 %v16, 0
38 br i1 %v17, label %b18, label %b32
41 %v20 = getelementptr inbounds %struct.0, ptr %v14, i32 0, i32 2, i32 0, i32 1
42 store i32 6, ptr %v20, align 4
43 %v21 = getelementptr inbounds %struct.0, ptr %a0, i32 0, i32 2, i32 0, i32 0
44 %v22 = load i32, ptr %v21, align 4
45 %v23 = getelementptr inbounds %struct.0, ptr %v14, i32 0, i32 2, i32 0, i32 0
46 %v24 = call i32 @f1(i32 %v22, ptr %v23)
47 %v25 = load ptr, ptr @G, align 4
48 %v26 = load i32, ptr %v25, align 4
49 %v27 = load ptr, ptr %v2, align 4
50 store i32 %v26, ptr %v27, align 4
51 %v28 = load ptr, ptr %v2, align 4
52 %v29 = getelementptr inbounds %struct.0, ptr %v28, i32 0, i32 2, i32 0, i32 1
53 %v30 = load i32, ptr %v29, align 4
54 %v31 = call i32 @f2(i32 %v30, i32 10, ptr %v29)
58 %v34 = load ptr, ptr %a0, align 4
59 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a0, ptr align 4 %v34, i32 48, i1 false)
62 b36: ; preds = %b32, %b18
66 declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture readonly, i32, i1) #1
68 declare i32 @f0(...) #0
69 declare i32 @f1(...) #0
70 declare i32 @f2(...) #0
72 attributes #0 = { nounwind }
73 attributes #1 = { argmemonly nounwind }