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 { ptr, ptr, ptr, ptr, ptr }
24 %struct.1 = type { [60 x i8], i32, ptr }
25 %struct.2 = type { i8, i8, i8, i8, %union.anon }
26 %union.anon = type { ptr }
27 %struct.3 = type { ptr, ptr }
29 @var = external hidden unnamed_addr global ptr, align 4
31 declare void @bar(ptr, i32) local_unnamed_addr #0
33 define void @foo() local_unnamed_addr #1 {
35 %.pr = load ptr, ptr @var, align 4, !tbaa !1
36 %cmp2 = icmp eq ptr %.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 ptr [ %4, %while.body ], [ %.pr, %while.body.preheader ]
44 %right = getelementptr inbounds %struct.0, ptr %0, i32 0, i32 4
45 %1 = bitcast ptr %right to ptr
46 %2 = load i32, ptr %1, align 4, !tbaa !5
47 %3 = bitcast ptr %0 to ptr
48 tail call void @bar(ptr %3, i32 20) #1
49 store i32 %2, ptr @var, align 4, !tbaa !1
50 %4 = inttoptr i32 %2 to ptr
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}