1 ; RUN: llc -march=hexagon < %s | FileCheck %s
3 ; The early return is predicated, and the save-restore code is mixed together:
6 ; if (p0.new) r17:16 = memd(r29 + #0)
7 ; memd(r29+#0) = r17:16
10 ; if (p0) dealloc_return
12 ; The problem is that the load will execute before the store, clobbering the
15 ; Check that the store and the load are not in the same packet.
16 ; CHECK: memd{{.*}} = r17:16
18 ; CHECK: r17:16 = memd
19 ; CHECK-LABEL: LBB0_1:
21 target triple = "hexagon"
23 %struct.0 = type { i8*, %struct.1*, %struct.2*, %struct.0*, %struct.0* }
24 %struct.1 = type { [60 x i8], i32, %struct.1* }
25 %struct.2 = type { i8, i8, i8, i8, %union.anon }
26 %union.anon = type { %struct.3* }
27 %struct.3 = type { %struct.3*, %struct.2* }
29 @var = external hidden unnamed_addr global %struct.0*, align 4
31 declare void @bar(i8*, i32) local_unnamed_addr #0
33 define void @foo() local_unnamed_addr #1 {
35 %.pr = load %struct.0*, %struct.0** @var, align 4, !tbaa !1
36 %cmp2 = icmp eq %struct.0* %.pr, null
37 br i1 %cmp2, label %while.end, label %while.body.preheader
39 while.body.preheader: ; preds = %entry
42 while.body: ; preds = %while.body.preheader, %while.body
43 %0 = phi %struct.0* [ %4, %while.body ], [ %.pr, %while.body.preheader ]
44 %right = getelementptr inbounds %struct.0, %struct.0* %0, i32 0, i32 4
45 %1 = bitcast %struct.0** %right to i32*
46 %2 = load i32, i32* %1, align 4, !tbaa !5
47 %3 = bitcast %struct.0* %0 to i8*
48 tail call void @bar(i8* %3, i32 20) #1
49 store i32 %2, i32* bitcast (%struct.0** @var to i32*), align 4, !tbaa !1
50 %4 = inttoptr i32 %2 to %struct.0*
51 %cmp = icmp eq i32 %2, 0
52 br i1 %cmp, label %while.end.loopexit, label %while.body
54 while.end.loopexit: ; preds = %while.body
57 while.end: ; preds = %while.end.loopexit, %entry
61 attributes #0 = { optsize }
62 attributes #1 = { nounwind optsize }
65 !2 = !{!"any pointer", !3, i64 0}
66 !3 = !{!"omnipotent char", !4, i64 0}
67 !4 = !{!"Simple C/C++ TBAA"}
68 !5 = !{!6, !2, i64 16}
69 !6 = !{!"0", !2, i64 0, !2, i64 4, !2, i64 8, !2, i64 12, !2, i64 16}