1+ # RUN: llc -mtriple=aarch64--- -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s
2+ --- |
3+
4+ @x = common global i32 0, align 4
5+
6+ define i32 @adrp_add() # 0 {
7+ ret i32 0
8+ }
9+
10+ define i32 @adrp_ldr() # 0 {
11+ ret i32 0
12+ }
13+
14+ define void @bar(i32 %a) # 0 {
15+ ret void
16+ }
17+
18+ attributes # 0 = { noinline noredzone }
19+ ...
20+ ---
21+ # This test ensures that we do not outline ADRP / ADD pair when it's referencing
22+ # a GOT entry.
23+ #
24+ # CHECK-LABEL: name: adrp_add
25+ # CHECK-DAG: bb.0:
26+ # CHECK: $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
27+ # CHECK: $x12 = ADDXri $x9, target-flags(aarch64-pageoff, aarch64-got) @x, 0
28+
29+ # CHECK-DAG: bb.1
30+ # CHECK: $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
31+ # CHECK: $x12 = ADDXri $x9, target-flags(aarch64-pageoff, aarch64-got) @x, 0
32+
33+ # CHECK-DAG: bb.2
34+ # CHECK: $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
35+ # CHECK: $x12 = ADDXri $x9, target-flags(aarch64-pageoff, aarch64-got) @x, 0
36+ name : adrp_add
37+ tracksRegLiveness : true
38+ body : |
39+ bb.0:
40+ liveins: $lr
41+ $w12 = ORRWri $wzr, 1
42+ $w12 = ORRWri $wzr, 1
43+ $w12 = ORRWri $wzr, 1
44+ $w12 = ORRWri $wzr, 1
45+ $w12 = ORRWri $wzr, 1
46+ $w12 = ORRWri $wzr, 1
47+ $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
48+ $x12 = ADDXri $x9, target-flags(aarch64-pageoff, aarch64-got) @x, 0
49+ $lr = ORRXri $xzr, 1
50+ bb.1:
51+ liveins: $lr
52+ $w12 = ORRWri $wzr, 1
53+ $w12 = ORRWri $wzr, 1
54+ $w12 = ORRWri $wzr, 1
55+ $w12 = ORRWri $wzr, 1
56+ $w12 = ORRWri $wzr, 1
57+ $w12 = ORRWri $wzr, 1
58+ $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
59+ $x12 = ADDXri $x9, target-flags(aarch64-pageoff, aarch64-got) @x, 0
60+ $lr = ORRXri $xzr, 1
61+ bb.2:
62+ liveins: $lr
63+ $w12 = ORRWri $wzr, 1
64+ $w12 = ORRWri $wzr, 1
65+ $w12 = ORRWri $wzr, 1
66+ $w12 = ORRWri $wzr, 1
67+ $w12 = ORRWri $wzr, 1
68+ $w12 = ORRWri $wzr, 1
69+ $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
70+ $x12 = ADDXri $x9, target-flags(aarch64-pageoff, aarch64-got) @x, 0
71+ $lr = ORRXri $xzr, 1
72+ bb.3:
73+ liveins: $lr
74+ RET undef $lr
75+ ...
76+ ---
77+ # This test ensures that we do not outline ADRP / LDR pair when it's referencing
78+ # a GOT entry.
79+ #
80+ # CHECK-LABEL: name: adrp_ldr
81+ # CHECK-DAG: bb.0:
82+ # CHECK: $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
83+ # CHECK: $x12 = LDRXui $x9, target-flags(aarch64-pageoff, aarch64-got) @x
84+
85+ # CHECK-DAG: bb.1
86+ # CHECK: $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
87+ # CHECK: $x12 = LDRXui $x9, target-flags(aarch64-pageoff, aarch64-got) @x
88+
89+ # CHECK-DAG: bb.2
90+ # CHECK: $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
91+ # CHECK: $x12 = LDRXui $x9, target-flags(aarch64-pageoff, aarch64-got) @x
92+ name : adrp_ldr
93+ tracksRegLiveness : true
94+ body : |
95+ bb.0:
96+ liveins: $lr
97+ $w12 = ORRWri $wzr, 1
98+ $w12 = ORRWri $wzr, 1
99+ $w12 = ORRWri $wzr, 1
100+ $w12 = ORRWri $wzr, 1
101+ $w12 = ORRWri $wzr, 1
102+ $w12 = ORRWri $wzr, 1
103+ $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
104+ $x12 = LDRXui $x9, target-flags(aarch64-pageoff, aarch64-got) @x
105+ $lr = ORRXri $xzr, 1
106+ bb.1:
107+ liveins: $lr
108+ $w12 = ORRWri $wzr, 1
109+ $w12 = ORRWri $wzr, 1
110+ $w12 = ORRWri $wzr, 1
111+ $w12 = ORRWri $wzr, 1
112+ $w12 = ORRWri $wzr, 1
113+ $w12 = ORRWri $wzr, 1
114+ $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
115+ $x12 = LDRXui $x9, target-flags(aarch64-pageoff, aarch64-got) @x
116+ $lr = ORRXri $xzr, 1
117+ bb.2:
118+ liveins: $lr
119+ $w12 = ORRWri $wzr, 1
120+ $w12 = ORRWri $wzr, 1
121+ $w12 = ORRWri $wzr, 1
122+ $w12 = ORRWri $wzr, 1
123+ $w12 = ORRWri $wzr, 1
124+ $w12 = ORRWri $wzr, 1
125+ $x9 = ADRP target-flags(aarch64-page, aarch64-got) @x
126+ $x12 = LDRXui $x9, target-flags(aarch64-pageoff, aarch64-got) @x
127+ $lr = ORRXri $xzr, 1
128+ bb.3:
129+ liveins: $lr
130+ RET undef $lr
0 commit comments