blob: 03aa72bc5a8cbdcb37028d3ebc6bd6918db7ed64 [file] [log] [blame]
Krzysztof Parzyszek64488112016-08-31 13:52:17 +00001; RUN: llc -march=hexagon < %s | FileCheck %s
2
3; The early return is predicated, and the save-restore code is mixed together:
4; {
5; p0 = cmp.eq(r0, #0)
6; if (p0.new) r17:16 = memd(r29 + #0)
7; memd(r29+#0) = r17:16
8; }
9; {
10; if (p0) dealloc_return
11; }
12; The problem is that the load will execute before the store, clobbering the
13; pair r17:16.
14;
15; Check that the store and the load are not in the same packet.
16; CHECK: memd{{.*}} = r17:16
17; CHECK: }
18; CHECK: r17:16 = memd
19; CHECK-LABEL: LBB0_1:
20
21target triple = "hexagon"
22
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* }
28
29@var = external hidden unnamed_addr global %struct.0*, align 4
30
31declare void @bar(i8*, i32) local_unnamed_addr #0
32
33define void @foo() local_unnamed_addr #1 {
34entry:
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
38
39while.body.preheader: ; preds = %entry
40 br label %while.body
41
42while.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
53
54while.end.loopexit: ; preds = %while.body
55 br label %while.end
56
57while.end: ; preds = %while.end.loopexit, %entry
58 ret void
59}
60
61attributes #0 = { optsize }
62attributes #1 = { nounwind optsize }
63
64!1 = !{!2, !2, i64 0}
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}