1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -x mir -run-pass=machine-outliner -simplify-mir -verify-machineinstrs < %s \
4 # RUN: llc -mtriple=riscv64 -x mir -run-pass=machine-outliner -simplify-mir -verify-machineinstrs < %s \
6 # RUN: llc -mtriple=riscv32 -x mir -run-pass=machine-outliner -simplify-mir --function-sections -verify-machineinstrs < %s \
7 # RUN: | FileCheck -check-prefix=CHECK-FS %s
8 # RUN: llc -mtriple=riscv64 -x mir -run-pass=machine-outliner -simplify-mir --function-sections -verify-machineinstrs < %s \
9 # RUN: | FileCheck -check-prefix=CHECK-FS %s
12 ; Cannot outline instructions with pcrel-lo operands if function section
14 @bar = dso_local local_unnamed_addr global i32 0, align 4
15 define i32 @foo(i32 %a, i32 %b) { ret i32 0 }
18 define i32 @foo2(i32 %a, i32 %b) comdat { ret i32 0 }
20 define i32 @foo3(i32 %a, i32 %b) section ".abc" { ret i32 0 }
24 tracksRegLiveness: true
26 ; CHECK-LABEL: name: foo
28 ; CHECK-NEXT: liveins: $x10, $x11, $x13
30 ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11, implicit $x13
31 ; CHECK-NEXT: PseudoBR %bb.3
34 ; CHECK-NEXT: liveins: $x10, $x11, $x13
36 ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11, implicit $x13
37 ; CHECK-NEXT: PseudoBR %bb.3
40 ; CHECK-NEXT: liveins: $x10, $x11, $x13
42 ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11, implicit $x13
43 ; CHECK-NEXT: PseudoBR %bb.3
46 ; CHECK-NEXT: PseudoRET
47 ; CHECK-FS-LABEL: name: foo
49 ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13
50 ; CHECK-FS-NEXT: {{ $}}
51 ; CHECK-FS-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11
52 ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
53 ; CHECK-FS-NEXT: PseudoBR %bb.3
54 ; CHECK-FS-NEXT: {{ $}}
55 ; CHECK-FS-NEXT: bb.1:
56 ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13
57 ; CHECK-FS-NEXT: {{ $}}
58 ; CHECK-FS-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11
59 ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
60 ; CHECK-FS-NEXT: PseudoBR %bb.3
61 ; CHECK-FS-NEXT: {{ $}}
62 ; CHECK-FS-NEXT: bb.2:
63 ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13
64 ; CHECK-FS-NEXT: {{ $}}
65 ; CHECK-FS-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11
66 ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
67 ; CHECK-FS-NEXT: PseudoBR %bb.3
68 ; CHECK-FS-NEXT: {{ $}}
69 ; CHECK-FS-NEXT: bb.3:
70 ; CHECK-FS-NEXT: PseudoRET
72 liveins: $x10, $x11, $x13
78 $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
82 liveins: $x10, $x11, $x13
88 $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
92 liveins: $x10, $x11, $x13
98 $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
106 tracksRegLiveness: true
108 ; CHECK-LABEL: name: foo2
110 ; CHECK-NEXT: liveins: $x10, $x11, $x13
112 ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_1, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11
113 ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
114 ; CHECK-NEXT: PseudoBR %bb.3
117 ; CHECK-NEXT: liveins: $x10, $x11, $x13
119 ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_1, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11
120 ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
121 ; CHECK-NEXT: PseudoBR %bb.3
124 ; CHECK-NEXT: liveins: $x10, $x11, $x13
126 ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_1, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11
127 ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
128 ; CHECK-NEXT: PseudoBR %bb.3
131 ; CHECK-NEXT: PseudoRET
132 ; CHECK-FS-LABEL: name: foo2
134 ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13
135 ; CHECK-FS-NEXT: {{ $}}
136 ; CHECK-FS-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11
137 ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
138 ; CHECK-FS-NEXT: PseudoBR %bb.3
139 ; CHECK-FS-NEXT: {{ $}}
140 ; CHECK-FS-NEXT: bb.1:
141 ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13
142 ; CHECK-FS-NEXT: {{ $}}
143 ; CHECK-FS-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11
144 ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
145 ; CHECK-FS-NEXT: PseudoBR %bb.3
146 ; CHECK-FS-NEXT: {{ $}}
147 ; CHECK-FS-NEXT: bb.2:
148 ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13
149 ; CHECK-FS-NEXT: {{ $}}
150 ; CHECK-FS-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11
151 ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
152 ; CHECK-FS-NEXT: PseudoBR %bb.3
153 ; CHECK-FS-NEXT: {{ $}}
154 ; CHECK-FS-NEXT: bb.3:
155 ; CHECK-FS-NEXT: PseudoRET
157 liveins: $x10, $x11, $x13
159 $x11 = ORI $x11, 1023
161 $x11 = AND $x12, $x11
162 $x10 = SUB $x10, $x11
163 $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
167 liveins: $x10, $x11, $x13
169 $x11 = ORI $x11, 1023
171 $x11 = AND $x12, $x11
172 $x10 = SUB $x10, $x11
173 $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
177 liveins: $x10, $x11, $x13
179 $x11 = ORI $x11, 1023
181 $x11 = AND $x12, $x11
182 $x10 = SUB $x10, $x11
183 $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
191 tracksRegLiveness: true
193 ; CHECK-LABEL: name: foo3
195 ; CHECK-NEXT: liveins: $x10, $x11, $x13
197 ; CHECK-NEXT: $x11 = ORI $x11, 1023
198 ; CHECK-NEXT: $x12 = ADDI $x10, 17
199 ; CHECK-NEXT: $x11 = AND $x12, $x11
200 ; CHECK-NEXT: $x10 = SUB $x10, $x11
201 ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
202 ; CHECK-NEXT: PseudoBR %bb.3
205 ; CHECK-NEXT: liveins: $x10, $x11, $x13
207 ; CHECK-NEXT: $x11 = ORI $x11, 1023
208 ; CHECK-NEXT: $x12 = ADDI $x10, 17
209 ; CHECK-NEXT: $x11 = AND $x12, $x11
210 ; CHECK-NEXT: $x10 = SUB $x10, $x11
211 ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
212 ; CHECK-NEXT: PseudoBR %bb.3
215 ; CHECK-NEXT: liveins: $x10, $x11, $x13
217 ; CHECK-NEXT: $x11 = ORI $x11, 1023
218 ; CHECK-NEXT: $x12 = ADDI $x10, 17
219 ; CHECK-NEXT: $x11 = AND $x12, $x11
220 ; CHECK-NEXT: $x10 = SUB $x10, $x11
221 ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
222 ; CHECK-NEXT: PseudoBR %bb.3
225 ; CHECK-NEXT: PseudoRET
226 ; CHECK-FS-LABEL: name: foo3
228 ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13
229 ; CHECK-FS-NEXT: {{ $}}
230 ; CHECK-FS-NEXT: $x11 = ORI $x11, 1023
231 ; CHECK-FS-NEXT: $x12 = ADDI $x10, 17
232 ; CHECK-FS-NEXT: $x11 = AND $x12, $x11
233 ; CHECK-FS-NEXT: $x10 = SUB $x10, $x11
234 ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
235 ; CHECK-FS-NEXT: PseudoBR %bb.3
236 ; CHECK-FS-NEXT: {{ $}}
237 ; CHECK-FS-NEXT: bb.1:
238 ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13
239 ; CHECK-FS-NEXT: {{ $}}
240 ; CHECK-FS-NEXT: $x11 = ORI $x11, 1023
241 ; CHECK-FS-NEXT: $x12 = ADDI $x10, 17
242 ; CHECK-FS-NEXT: $x11 = AND $x12, $x11
243 ; CHECK-FS-NEXT: $x10 = SUB $x10, $x11
244 ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
245 ; CHECK-FS-NEXT: PseudoBR %bb.3
246 ; CHECK-FS-NEXT: {{ $}}
247 ; CHECK-FS-NEXT: bb.2:
248 ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13
249 ; CHECK-FS-NEXT: {{ $}}
250 ; CHECK-FS-NEXT: $x11 = ORI $x11, 1023
251 ; CHECK-FS-NEXT: $x12 = ADDI $x10, 17
252 ; CHECK-FS-NEXT: $x11 = AND $x12, $x11
253 ; CHECK-FS-NEXT: $x10 = SUB $x10, $x11
254 ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
255 ; CHECK-FS-NEXT: PseudoBR %bb.3
256 ; CHECK-FS-NEXT: {{ $}}
257 ; CHECK-FS-NEXT: bb.3:
258 ; CHECK-FS-NEXT: PseudoRET
260 liveins: $x10, $x11, $x13
262 $x11 = ORI $x11, 1023
264 $x11 = AND $x12, $x11
265 $x10 = SUB $x10, $x11
266 $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
270 liveins: $x10, $x11, $x13
272 $x11 = ORI $x11, 1023
274 $x11 = AND $x12, $x11
275 $x10 = SUB $x10, $x11
276 $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)
280 liveins: $x10, $x11, $x13
282 $x11 = ORI $x11, 1023
284 $x11 = AND $x12, $x11
285 $x10 = SUB $x10, $x11
286 $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1> :: (dereferenceable load (s32) from @bar)