File: | build/source/build-llvm/tools/clang/stage2-bins/lib/Target/AArch64/AArch64GenPreLegalizeGICombiner.inc |
Warning: | line 3094, column 7 Value stored to 'Partition' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | |* *| |
3 | |* Global Combiner *| |
4 | |* *| |
5 | |* Automatically generated file, do not edit! *| |
6 | |* *| |
7 | \*===----------------------------------------------------------------------===*/ |
8 | |
9 | #ifdef AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_DEPS |
10 | #include "llvm/ADT/SparseBitVector.h" |
11 | namespace llvm { |
12 | extern cl::OptionCategory GICombinerOptionCategory; |
13 | } // end namespace llvm |
14 | #endif // ifdef AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_DEPS |
15 | |
16 | #ifdef AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_H |
17 | class AArch64GenPreLegalizerCombinerHelperRuleConfig { |
18 | SparseBitVector<> DisabledRules; |
19 | |
20 | public: |
21 | bool parseCommandLineOption(); |
22 | bool isRuleDisabled(unsigned ID) const; |
23 | bool setRuleEnabled(StringRef RuleIdentifier); |
24 | bool setRuleDisabled(StringRef RuleIdentifier); |
25 | }; |
26 | |
27 | class AArch64GenPreLegalizerCombinerHelper : public AArch64PreLegalizerCombinerHelperState { |
28 | const AArch64GenPreLegalizerCombinerHelperRuleConfig *RuleConfig; |
29 | |
30 | public: |
31 | template <typename... Args>AArch64GenPreLegalizerCombinerHelper(const AArch64GenPreLegalizerCombinerHelperRuleConfig &RuleConfig, Args &&... args) : AArch64PreLegalizerCombinerHelperState(std::forward<Args>(args)...), RuleConfig(&RuleConfig) {} |
32 | |
33 | bool tryCombineAll( |
34 | GISelChangeObserver &Observer, |
35 | MachineInstr &MI, |
36 | MachineIRBuilder &B) const; |
37 | }; |
38 | |
39 | static std::optional<uint64_t> getRuleIdxForIdentifier(StringRef RuleIdentifier) { |
40 | uint64_t I; |
41 | // getAtInteger(...) returns false on success |
42 | bool Parsed = !RuleIdentifier.getAsInteger(0, I); |
43 | if (Parsed) |
44 | return I; |
45 | |
46 | #ifndef NDEBUG |
47 | switch (RuleIdentifier.size()) { |
48 | default: break; |
49 | case 9: // 4 strings to match. |
50 | switch (RuleIdentifier[0]) { |
51 | default: break; |
52 | case 'a': // 1 string to match. |
53 | if (memcmp(RuleIdentifier.data()+1, "ddo_by_0", 8) != 0) |
54 | break; |
55 | return 74; // "addo_by_0" |
56 | case 'c': // 1 string to match. |
57 | if (memcmp(RuleIdentifier.data()+1, "opy_prop", 8) != 0) |
58 | break; |
59 | return 0; // "copy_prop" |
60 | case 'm': // 2 strings to match. |
61 | if (memcmp(RuleIdentifier.data()+1, "ulo_by_", 7) != 0) |
62 | break; |
63 | switch (RuleIdentifier[8]) { |
64 | default: break; |
65 | case '0': // 1 string to match. |
66 | return 73; // "mulo_by_0" |
67 | case '2': // 1 string to match. |
68 | return 72; // "mulo_by_2" |
69 | } |
70 | break; |
71 | } |
72 | break; |
73 | case 10: // 3 strings to match. |
74 | switch (RuleIdentifier[0]) { |
75 | default: break; |
76 | case 'i': // 1 string to match. |
77 | if (memcmp(RuleIdentifier.data()+1, "2p_to_p2i", 9) != 0) |
78 | break; |
79 | return 29; // "i2p_to_p2i" |
80 | case 'm': // 1 string to match. |
81 | if (memcmp(RuleIdentifier.data()+1, "ul_to_shl", 9) != 0) |
82 | break; |
83 | return 1; // "mul_to_shl" |
84 | case 'p': // 1 string to match. |
85 | if (memcmp(RuleIdentifier.data()+1, "2i_to_i2p", 9) != 0) |
86 | break; |
87 | return 28; // "p2i_to_i2p" |
88 | } |
89 | break; |
90 | case 11: // 4 strings to match. |
91 | switch (RuleIdentifier[0]) { |
92 | default: break; |
93 | case 'a': // 1 string to match. |
94 | if (memcmp(RuleIdentifier.data()+1, "dd_sub_reg", 10) != 0) |
95 | break; |
96 | return 33; // "add_sub_reg" |
97 | case 's': // 1 string to match. |
98 | if (memcmp(RuleIdentifier.data()+1, "ub_add_reg", 10) != 0) |
99 | break; |
100 | return 106; // "sub_add_reg" |
101 | case 't': // 1 string to match. |
102 | if (memcmp(RuleIdentifier.data()+1, "runc_shift", 10) != 0) |
103 | break; |
104 | return 68; // "trunc_shift" |
105 | case 'u': // 1 string to match. |
106 | if (memcmp(RuleIdentifier.data()+1, "nmerge_cst", 10) != 0) |
107 | break; |
108 | return 63; // "unmerge_cst" |
109 | } |
110 | break; |
111 | case 12: // 6 strings to match. |
112 | switch (RuleIdentifier[0]) { |
113 | default: break; |
114 | case 'a': // 1 string to match. |
115 | if (memcmp(RuleIdentifier.data()+1, "dde_to_addo", 11) != 0) |
116 | break; |
117 | return 75; // "adde_to_addo" |
118 | case 'e': // 1 string to match. |
119 | if (memcmp(RuleIdentifier.data()+1, "xt_ext_fold", 11) != 0) |
120 | break; |
121 | return 59; // "ext_ext_fold" |
122 | case 'f': // 1 string to match. |
123 | if (memcmp(RuleIdentifier.data()+1, "sub_to_fneg", 11) != 0) |
124 | break; |
125 | return 109; // "fsub_to_fneg" |
126 | case 'm': // 1 string to match. |
127 | if (memcmp(RuleIdentifier.data()+1, "ulh_to_lshr", 11) != 0) |
128 | break; |
129 | return 94; // "mulh_to_lshr" |
130 | case 'n': // 1 string to match. |
131 | if (memcmp(RuleIdentifier.data()+1, "ot_cmp_fold", 11) != 0) |
132 | break; |
133 | return 60; // "not_cmp_fold" |
134 | case 'r': // 1 string to match. |
135 | if (memcmp(RuleIdentifier.data()+1, "edundant_or", 11) != 0) |
136 | break; |
137 | return 53; // "redundant_or" |
138 | } |
139 | break; |
140 | case 13: // 8 strings to match. |
141 | switch (RuleIdentifier[0]) { |
142 | default: break; |
143 | case 'c': // 1 string to match. |
144 | if (memcmp(RuleIdentifier.data()+1, "onstant_fold", 12) != 0) |
145 | break; |
146 | return 90; // "constant_fold" |
147 | case 'l': // 1 string to match. |
148 | if (memcmp(RuleIdentifier.data()+1, "oad_and_mask", 12) != 0) |
149 | break; |
150 | return 9; // "load_and_mask" |
151 | case 'm': // 1 string to match. |
152 | if (memcmp(RuleIdentifier.data()+1, "erge_unmerge", 12) != 0) |
153 | break; |
154 | return 66; // "merge_unmerge" |
155 | case 'r': // 1 string to match. |
156 | if (memcmp(RuleIdentifier.data()+1, "edundant_and", 12) != 0) |
157 | break; |
158 | return 51; // "redundant_and" |
159 | case 's': // 1 string to match. |
160 | if (memcmp(RuleIdentifier.data()+1, "div_by_const", 12) != 0) |
161 | break; |
162 | return 93; // "sdiv_by_const" |
163 | case 'u': // 3 strings to match. |
164 | switch (RuleIdentifier[1]) { |
165 | default: break; |
166 | case 'd': // 1 string to match. |
167 | if (memcmp(RuleIdentifier.data()+2, "iv_by_const", 11) != 0) |
168 | break; |
169 | return 92; // "udiv_by_const" |
170 | case 'n': // 2 strings to match. |
171 | if (memcmp(RuleIdentifier.data()+2, "merge_", 6) != 0) |
172 | break; |
173 | switch (RuleIdentifier[8]) { |
174 | default: break; |
175 | case 'm': // 1 string to match. |
176 | if (memcmp(RuleIdentifier.data()+9, "erge", 4) != 0) |
177 | break; |
178 | return 62; // "unmerge_merge" |
179 | case 'u': // 1 string to match. |
180 | if (memcmp(RuleIdentifier.data()+9, "ndef", 4) != 0) |
181 | break; |
182 | return 21; // "unmerge_undef" |
183 | } |
184 | break; |
185 | } |
186 | break; |
187 | } |
188 | break; |
189 | case 14: // 8 strings to match. |
190 | switch (RuleIdentifier[0]) { |
191 | default: break; |
192 | case 'b': // 1 string to match. |
193 | if (memcmp(RuleIdentifier.data()+1, "inop_same_val", 13) != 0) |
194 | break; |
195 | return 25; // "binop_same_val" |
196 | case 'c': // 1 string to match. |
197 | if (memcmp(RuleIdentifier.data()+1, "onstant_fp_op", 13) != 0) |
198 | break; |
199 | return 69; // "constant_fp_op" |
200 | case 'f': // 2 strings to match. |
201 | switch (RuleIdentifier[1]) { |
202 | default: break; |
203 | case 'a': // 1 string to match. |
204 | if (memcmp(RuleIdentifier.data()+2, "bs_fneg_fold", 12) != 0) |
205 | break; |
206 | return 91; // "fabs_fneg_fold" |
207 | case 'n': // 1 string to match. |
208 | if (memcmp(RuleIdentifier.data()+2, "eg_fneg_fold", 12) != 0) |
209 | break; |
210 | return 31; // "fneg_fneg_fold" |
211 | } |
212 | break; |
213 | case 'm': // 1 string to match. |
214 | if (memcmp(RuleIdentifier.data()+1, "ul_by_neg_one", 13) != 0) |
215 | break; |
216 | return 3; // "mul_by_neg_one" |
217 | case 'r': // 1 string to match. |
218 | if (memcmp(RuleIdentifier.data()+1, "eassoc_ptradd", 13) != 0) |
219 | break; |
220 | return 42; // "reassoc_ptradd" |
221 | case 's': // 1 string to match. |
222 | if (memcmp(RuleIdentifier.data()+1, "hifts_too_big", 13) != 0) |
223 | break; |
224 | return 41; // "shifts_too_big" |
225 | case 't': // 1 string to match. |
226 | if (memcmp(RuleIdentifier.data()+1, "runc_ext_fold", 13) != 0) |
227 | break; |
228 | return 67; // "trunc_ext_fold" |
229 | } |
230 | break; |
231 | case 15: // 6 strings to match. |
232 | switch (RuleIdentifier[0]) { |
233 | default: break; |
234 | case 'e': // 1 string to match. |
235 | if (memcmp(RuleIdentifier.data()+1, "xtending_loads", 14) != 0) |
236 | break; |
237 | return 8; // "extending_loads" |
238 | case 'i': // 1 string to match. |
239 | if (memcmp(RuleIdentifier.data()+1, "dempotent_prop", 14) != 0) |
240 | break; |
241 | return 4; // "idempotent_prop" |
242 | case 'l': // 1 string to match. |
243 | if (memcmp(RuleIdentifier.data()+1, "oad_or_combine", 14) != 0) |
244 | break; |
245 | return 81; // "load_or_combine" |
246 | case 'o': // 1 string to match. |
247 | if (memcmp(RuleIdentifier.data()+1, "verlapping_and", 14) != 0) |
248 | break; |
249 | return 71; // "overlapping_and" |
250 | case 's': // 1 string to match. |
251 | if (memcmp(RuleIdentifier.data()+1, "elect_same_val", 14) != 0) |
252 | break; |
253 | return 23; // "select_same_val" |
254 | case 'z': // 1 string to match. |
255 | if (memcmp(RuleIdentifier.data()+1, "ext_trunc_fold", 14) != 0) |
256 | break; |
257 | return 55; // "zext_trunc_fold" |
258 | } |
259 | break; |
260 | case 16: // 4 strings to match. |
261 | switch (RuleIdentifier[0]) { |
262 | default: break; |
263 | case 's': // 2 strings to match. |
264 | if (memcmp(RuleIdentifier.data()+1, "elect_", 6) != 0) |
265 | break; |
266 | switch (RuleIdentifier[7]) { |
267 | default: break; |
268 | case 't': // 1 string to match. |
269 | if (memcmp(RuleIdentifier.data()+8, "o_minmax", 8) != 0) |
270 | break; |
271 | return 107; // "select_to_minmax" |
272 | case 'u': // 1 string to match. |
273 | if (memcmp(RuleIdentifier.data()+8, "ndef_cmp", 8) != 0) |
274 | break; |
275 | return 48; // "select_undef_cmp" |
276 | } |
277 | break; |
278 | case 't': // 1 string to match. |
279 | if (memcmp(RuleIdentifier.data()+1, "runcstore_merge", 15) != 0) |
280 | break; |
281 | return 82; // "truncstore_merge" |
282 | case 'u': // 1 string to match. |
283 | if (memcmp(RuleIdentifier.data()+1, "ndef_to_fp_zero", 15) != 0) |
284 | break; |
285 | return 11; // "undef_to_fp_zero" |
286 | } |
287 | break; |
288 | case 17: // 9 strings to match. |
289 | switch (RuleIdentifier[0]) { |
290 | default: break; |
291 | case 'a': // 2 strings to match. |
292 | switch (RuleIdentifier[1]) { |
293 | default: break; |
294 | case 'd': // 1 string to match. |
295 | if (memcmp(RuleIdentifier.data()+2, "d_p2i_to_ptradd", 15) != 0) |
296 | break; |
297 | return 2; // "add_p2i_to_ptradd" |
298 | case 'n': // 1 string to match. |
299 | if (memcmp(RuleIdentifier.data()+2, "yext_trunc_fold", 15) != 0) |
300 | break; |
301 | return 30; // "anyext_trunc_fold" |
302 | } |
303 | break; |
304 | case 'd': // 1 string to match. |
305 | if (memcmp(RuleIdentifier.data()+1, "iv_rem_to_divrem", 16) != 0) |
306 | break; |
307 | return 83; // "div_rem_to_divrem" |
308 | case 'e': // 1 string to match. |
309 | if (memcmp(RuleIdentifier.data()+1, "rase_undef_store", 16) != 0) |
310 | break; |
311 | return 20; // "erase_undef_store" |
312 | case 'p': // 1 string to match. |
313 | if (memcmp(RuleIdentifier.data()+1, "tr_add_with_zero", 16) != 0) |
314 | break; |
315 | return 78; // "ptr_add_with_zero" |
316 | case 's': // 2 strings to match. |
317 | switch (RuleIdentifier[1]) { |
318 | default: break; |
319 | case 'e': // 1 string to match. |
320 | if (memcmp(RuleIdentifier.data()+2, "lect_to_logical", 15) != 0) |
321 | break; |
322 | return 50; // "select_to_logical" |
323 | case 'h': // 1 string to match. |
324 | if (memcmp(RuleIdentifier.data()+2, "ift_immed_chain", 15) != 0) |
325 | break; |
326 | return 79; // "shift_immed_chain" |
327 | } |
328 | break; |
329 | case 'u': // 2 strings to match. |
330 | switch (RuleIdentifier[1]) { |
331 | default: break; |
332 | case 'n': // 1 string to match. |
333 | if (memcmp(RuleIdentifier.data()+2, "def_to_int_zero", 15) != 0) |
334 | break; |
335 | return 12; // "undef_to_int_zero" |
336 | case 'r': // 1 string to match. |
337 | if (memcmp(RuleIdentifier.data()+2, "em_pow2_to_mask", 15) != 0) |
338 | break; |
339 | return 54; // "urem_pow2_to_mask" |
340 | } |
341 | break; |
342 | } |
343 | break; |
344 | case 18: // 5 strings to match. |
345 | switch (RuleIdentifier[0]) { |
346 | default: break; |
347 | case 'b': // 1 string to match. |
348 | if (memcmp(RuleIdentifier.data()+1, "inop_left_to_zero", 17) != 0) |
349 | break; |
350 | return 26; // "binop_left_to_zero" |
351 | case 'c': // 1 string to match. |
352 | if (memcmp(RuleIdentifier.data()+1, "ombine_minmax_nan", 17) != 0) |
353 | break; |
354 | return 76; // "combine_minmax_nan" |
355 | case 'f': // 1 string to match. |
356 | if (memcmp(RuleIdentifier.data()+1, "old_global_offset", 17) != 0) |
357 | break; |
358 | return 113; // "fold_global_offset" |
359 | case 'r': // 1 string to match. |
360 | if (memcmp(RuleIdentifier.data()+1, "ight_identity_one", 17) != 0) |
361 | break; |
362 | return 32; // "right_identity_one" |
363 | case 's': // 1 string to match. |
364 | if (memcmp(RuleIdentifier.data()+1, "ext_inreg_of_load", 17) != 0) |
365 | break; |
366 | return 45; // "sext_inreg_of_load" |
367 | } |
368 | break; |
369 | case 19: // 8 strings to match. |
370 | switch (RuleIdentifier[0]) { |
371 | default: break; |
372 | case 'b': // 1 string to match. |
373 | if (memcmp(RuleIdentifier.data()+1, "inop_right_to_zero", 18) != 0) |
374 | break; |
375 | return 27; // "binop_right_to_zero" |
376 | case 'c': // 1 string to match. |
377 | if (memcmp(RuleIdentifier.data()+1, "onst_ptradd_to_i2p", 18) != 0) |
378 | break; |
379 | return 70; // "const_ptradd_to_i2p" |
380 | case 'e': // 1 string to match. |
381 | if (memcmp(RuleIdentifier.data()+1, "xtend_through_phis", 18) != 0) |
382 | break; |
383 | return 38; // "extend_through_phis" |
384 | case 'p': // 1 string to match. |
385 | if (memcmp(RuleIdentifier.data()+1, "tr_add_immed_chain", 18) != 0) |
386 | break; |
387 | return 43; // "ptr_add_immed_chain" |
388 | case 'r': // 1 string to match. |
389 | if (memcmp(RuleIdentifier.data()+1, "ight_identity_zero", 18) != 0) |
390 | break; |
391 | return 24; // "right_identity_zero" |
392 | case 's': // 2 strings to match. |
393 | switch (RuleIdentifier[1]) { |
394 | default: break; |
395 | case 'e': // 1 string to match. |
396 | if (memcmp(RuleIdentifier.data()+2, "lect_constant_cmp", 17) != 0) |
397 | break; |
398 | return 49; // "select_constant_cmp" |
399 | case 'i': // 1 string to match. |
400 | if (memcmp(RuleIdentifier.data()+2, "mplify_add_to_sub", 17) != 0) |
401 | break; |
402 | return 39; // "simplify_add_to_sub" |
403 | } |
404 | break; |
405 | case 'u': // 1 string to match. |
406 | if (memcmp(RuleIdentifier.data()+1, "nary_undef_to_zero", 18) != 0) |
407 | break; |
408 | return 16; // "unary_undef_to_zero" |
409 | } |
410 | break; |
411 | case 20: // 6 strings to match. |
412 | switch (RuleIdentifier[0]) { |
413 | default: break; |
414 | case 'a': // 1 string to match. |
415 | if (memcmp(RuleIdentifier.data()+1, "nd_or_disjoint_mask", 19) != 0) |
416 | break; |
417 | return 96; // "and_or_disjoint_mask" |
418 | case 'b': // 1 string to match. |
419 | if (memcmp(RuleIdentifier.data()+1, "itcast_bitcast_fold", 19) != 0) |
420 | break; |
421 | return 37; // "bitcast_bitcast_fold" |
422 | case 'i': // 1 string to match. |
423 | if (memcmp(RuleIdentifier.data()+1, "cmp_redundant_trunc", 19) != 0) |
424 | break; |
425 | return 112; // "icmp_redundant_trunc" |
426 | case 'r': // 2 strings to match. |
427 | if (memcmp(RuleIdentifier.data()+1, "edu", 3) != 0) |
428 | break; |
429 | switch (RuleIdentifier[4]) { |
430 | default: break; |
431 | case 'c': // 1 string to match. |
432 | if (memcmp(RuleIdentifier.data()+5, "e_shl_of_extend", 15) != 0) |
433 | break; |
434 | return 46; // "reduce_shl_of_extend" |
435 | case 'n': // 1 string to match. |
436 | if (memcmp(RuleIdentifier.data()+5, "dant_sext_inreg", 15) != 0) |
437 | break; |
438 | return 52; // "redundant_sext_inreg" |
439 | } |
440 | break; |
441 | case 'u': // 1 string to match. |
442 | if (memcmp(RuleIdentifier.data()+1, "nmerge_zext_to_zext", 19) != 0) |
443 | break; |
444 | return 65; // "unmerge_zext_to_zext" |
445 | } |
446 | break; |
447 | case 21: // 3 strings to match. |
448 | switch (RuleIdentifier[0]) { |
449 | default: break; |
450 | case 'f': // 1 string to match. |
451 | if (memcmp(RuleIdentifier.data()+1, "constant_to_constant", 20) != 0) |
452 | break; |
453 | return 111; // "fconstant_to_constant" |
454 | case 'u': // 2 strings to match. |
455 | if (RuleIdentifier[1] != 'n') |
456 | break; |
457 | switch (RuleIdentifier[2]) { |
458 | default: break; |
459 | case 'd': // 1 string to match. |
460 | if (memcmp(RuleIdentifier.data()+3, "ef_to_negative_one", 18) != 0) |
461 | break; |
462 | return 13; // "undef_to_negative_one" |
463 | case 'm': // 1 string to match. |
464 | if (memcmp(RuleIdentifier.data()+3, "erge_dead_to_trunc", 18) != 0) |
465 | break; |
466 | return 64; // "unmerge_dead_to_trunc" |
467 | } |
468 | break; |
469 | } |
470 | break; |
471 | case 22: // 7 strings to match. |
472 | switch (RuleIdentifier[0]) { |
473 | default: break; |
474 | case 'f': // 2 strings to match. |
475 | switch (RuleIdentifier[1]) { |
476 | default: break; |
477 | case 'o': // 1 string to match. |
478 | if (memcmp(RuleIdentifier.data()+2, "ld_binop_into_select", 20) != 0) |
479 | break; |
480 | return 105; // "fold_binop_into_select" |
481 | case 'u': // 1 string to match. |
482 | if (memcmp(RuleIdentifier.data()+2, "nnel_shift_to_rotate", 20) != 0) |
483 | break; |
484 | return 85; // "funnel_shift_to_rotate" |
485 | } |
486 | break; |
487 | case 'i': // 1 string to match. |
488 | if (memcmp(RuleIdentifier.data()+1, "cmp_to_lhs_known_bits", 21) != 0) |
489 | break; |
490 | return 57; // "icmp_to_lhs_known_bits" |
491 | case 'p': // 1 string to match. |
492 | if (memcmp(RuleIdentifier.data()+1, "ropagate_undef_any_op", 21) != 0) |
493 | break; |
494 | return 17; // "propagate_undef_any_op" |
495 | case 'r': // 1 string to match. |
496 | if (memcmp(RuleIdentifier.data()+1, "edundant_neg_operands", 21) != 0) |
497 | break; |
498 | return 95; // "redundant_neg_operands" |
499 | case 's': // 1 string to match. |
500 | if (memcmp(RuleIdentifier.data()+1, "hl_ashr_to_sext_inreg", 21) != 0) |
501 | break; |
502 | return 44; // "shl_ashr_to_sext_inreg" |
503 | case 't': // 1 string to match. |
504 | if (memcmp(RuleIdentifier.data()+1, "runc_buildvector_fold", 21) != 0) |
505 | break; |
506 | return 35; // "trunc_buildvector_fold" |
507 | } |
508 | break; |
509 | case 23: // 2 strings to match. |
510 | switch (RuleIdentifier[0]) { |
511 | default: break; |
512 | case 'c': // 1 string to match. |
513 | if (memcmp(RuleIdentifier.data()+1, "ommute_constant_to_rhs", 22) != 0) |
514 | break; |
515 | return 110; // "commute_constant_to_rhs" |
516 | case 'p': // 1 string to match. |
517 | if (memcmp(RuleIdentifier.data()+1, "ropagate_undef_all_ops", 22) != 0) |
518 | break; |
519 | return 18; // "propagate_undef_all_ops" |
520 | } |
521 | break; |
522 | case 24: // 4 strings to match. |
523 | switch (RuleIdentifier[0]) { |
524 | default: break; |
525 | case 'b': // 1 string to match. |
526 | if (memcmp(RuleIdentifier.data()+1, "inop_left_undef_to_zero", 23) != 0) |
527 | break; |
528 | return 14; // "binop_left_undef_to_zero" |
529 | case 'n': // 1 string to match. |
530 | if (memcmp(RuleIdentifier.data()+1, "arrow_binop_feeding_and", 23) != 0) |
531 | break; |
532 | return 47; // "narrow_binop_feeding_and" |
533 | case 's': // 1 string to match. |
534 | if (memcmp(RuleIdentifier.data()+1, "ext_inreg_to_zext_inreg", 23) != 0) |
535 | break; |
536 | return 58; // "sext_inreg_to_zext_inreg" |
537 | case 'x': // 1 string to match. |
538 | if (memcmp(RuleIdentifier.data()+1, "or_of_and_with_same_reg", 23) != 0) |
539 | break; |
540 | return 77; // "xor_of_and_with_same_reg" |
541 | } |
542 | break; |
543 | case 25: // 4 strings to match. |
544 | switch (RuleIdentifier[0]) { |
545 | default: break; |
546 | case 'b': // 3 strings to match. |
547 | switch (RuleIdentifier[1]) { |
548 | default: break; |
549 | case 'i': // 2 strings to match. |
550 | if (memcmp(RuleIdentifier.data()+2, "tfield_extract_from_", 20) != 0) |
551 | break; |
552 | switch (RuleIdentifier[22]) { |
553 | default: break; |
554 | case 'a': // 1 string to match. |
555 | if (memcmp(RuleIdentifier.data()+23, "nd", 2) != 0) |
556 | break; |
557 | return 87; // "bitfield_extract_from_and" |
558 | case 's': // 1 string to match. |
559 | if (memcmp(RuleIdentifier.data()+23, "hr", 2) != 0) |
560 | break; |
561 | return 88; // "bitfield_extract_from_shr" |
562 | } |
563 | break; |
564 | case 'u': // 1 string to match. |
565 | if (memcmp(RuleIdentifier.data()+2, "ildvector_identity_fold", 23) != 0) |
566 | break; |
567 | return 34; // "buildvector_identity_fold" |
568 | } |
569 | break; |
570 | case 'e': // 1 string to match. |
571 | if (memcmp(RuleIdentifier.data()+1, "xtract_vec_elt_build_vec", 24) != 0) |
572 | break; |
573 | return 6; // "extract_vec_elt_build_vec" |
574 | } |
575 | break; |
576 | case 26: // 3 strings to match. |
577 | switch (RuleIdentifier[0]) { |
578 | default: break; |
579 | case 'b': // 1 string to match. |
580 | if (memcmp(RuleIdentifier.data()+1, "inop_right_undef_to_undef", 25) != 0) |
581 | break; |
582 | return 15; // "binop_right_undef_to_undef" |
583 | case 'c': // 1 string to match. |
584 | if (memcmp(RuleIdentifier.data()+1, "ombine_indexed_load_store", 25) != 0) |
585 | break; |
586 | return 10; // "combine_indexed_load_store" |
587 | case 'f': // 1 string to match. |
588 | if (memcmp(RuleIdentifier.data()+1, "unnel_shift_from_or_shift", 25) != 0) |
589 | break; |
590 | return 84; // "funnel_shift_from_or_shift" |
591 | } |
592 | break; |
593 | case 27: // 2 strings to match. |
594 | switch (RuleIdentifier[0]) { |
595 | default: break; |
596 | case 'r': // 1 string to match. |
597 | if (memcmp(RuleIdentifier.data()+1, "edundant_binop_in_equality", 26) != 0) |
598 | break; |
599 | return 108; // "redundant_binop_in_equality" |
600 | case 't': // 1 string to match. |
601 | if (memcmp(RuleIdentifier.data()+1, "runc_lshr_buildvector_fold", 26) != 0) |
602 | break; |
603 | return 36; // "trunc_lshr_buildvector_fold" |
604 | } |
605 | break; |
606 | case 28: // 3 strings to match. |
607 | switch (RuleIdentifier[0]) { |
608 | default: break; |
609 | case 'o': // 1 string to match. |
610 | if (memcmp(RuleIdentifier.data()+1, "pt_brcond_by_inverting_cond", 27) != 0) |
611 | break; |
612 | return 61; // "opt_brcond_by_inverting_cond" |
613 | case 'p': // 1 string to match. |
614 | if (memcmp(RuleIdentifier.data()+1, "ropagate_undef_shuffle_mask", 27) != 0) |
615 | break; |
616 | return 19; // "propagate_undef_shuffle_mask" |
617 | case 's': // 1 string to match. |
618 | if (memcmp(RuleIdentifier.data()+1, "hift_of_shifted_logic_chain", 27) != 0) |
619 | break; |
620 | return 80; // "shift_of_shifted_logic_chain" |
621 | } |
622 | break; |
623 | case 29: // 2 strings to match. |
624 | switch (RuleIdentifier[0]) { |
625 | default: break; |
626 | case 'b': // 1 string to match. |
627 | if (memcmp(RuleIdentifier.data()+1, "itfield_extract_from_shr_and", 28) != 0) |
628 | break; |
629 | return 89; // "bitfield_extract_from_shr_and" |
630 | case 'i': // 1 string to match. |
631 | if (memcmp(RuleIdentifier.data()+1, "cmp_to_true_false_known_bits", 28) != 0) |
632 | break; |
633 | return 56; // "icmp_to_true_false_known_bits" |
634 | } |
635 | break; |
636 | case 32: // 3 strings to match. |
637 | switch (RuleIdentifier[0]) { |
638 | default: break; |
639 | case 'b': // 1 string to match. |
640 | if (memcmp(RuleIdentifier.data()+1, "itfield_extract_from_sext_inreg", 31) != 0) |
641 | break; |
642 | return 86; // "bitfield_extract_from_sext_inreg" |
643 | case 'c': // 2 strings to match. |
644 | if (memcmp(RuleIdentifier.data()+1, "ombine_f", 8) != 0) |
645 | break; |
646 | switch (RuleIdentifier[9]) { |
647 | default: break; |
648 | case 'a': // 1 string to match. |
649 | if (memcmp(RuleIdentifier.data()+10, "dd_fmul_to_fmad_or_fma", 22) != 0) |
650 | break; |
651 | return 97; // "combine_fadd_fmul_to_fmad_or_fma" |
652 | case 's': // 1 string to match. |
653 | if (memcmp(RuleIdentifier.data()+10, "ub_fmul_to_fmad_or_fma", 22) != 0) |
654 | break; |
655 | return 101; // "combine_fsub_fmul_to_fmad_or_fma" |
656 | } |
657 | break; |
658 | } |
659 | break; |
660 | case 34: // 1 string to match. |
661 | if (memcmp(RuleIdentifier.data()+0, "extract_all_elts_from_build_vector", 34) != 0) |
662 | break; |
663 | return 7; // "extract_all_elts_from_build_vector" |
664 | case 36: // 3 strings to match. |
665 | switch (RuleIdentifier[0]) { |
666 | default: break; |
667 | case 'c': // 2 strings to match. |
668 | if (memcmp(RuleIdentifier.data()+1, "ombine_", 7) != 0) |
669 | break; |
670 | switch (RuleIdentifier[8]) { |
671 | default: break; |
672 | case 'f': // 1 string to match. |
673 | if (memcmp(RuleIdentifier.data()+9, "add_fma_fmul_to_fmad_or_fma", 27) != 0) |
674 | break; |
675 | return 99; // "combine_fadd_fma_fmul_to_fmad_or_fma" |
676 | case 'i': // 1 string to match. |
677 | if (memcmp(RuleIdentifier.data()+9, "nsert_vec_elts_build_vector", 27) != 0) |
678 | break; |
679 | return 5; // "combine_insert_vec_elts_build_vector" |
680 | } |
681 | break; |
682 | case 'i': // 1 string to match. |
683 | if (memcmp(RuleIdentifier.data()+1, "nsert_extract_vec_elt_out_of_bounds", 35) != 0) |
684 | break; |
685 | return 22; // "insert_extract_vec_elt_out_of_bounds" |
686 | } |
687 | break; |
688 | case 37: // 2 strings to match. |
689 | switch (RuleIdentifier[0]) { |
690 | default: break; |
691 | case 'c': // 1 string to match. |
692 | if (memcmp(RuleIdentifier.data()+1, "ombine_fsub_fneg_fmul_to_fmad_or_fma", 36) != 0) |
693 | break; |
694 | return 102; // "combine_fsub_fneg_fmul_to_fmad_or_fma" |
695 | case 'h': // 1 string to match. |
696 | if (memcmp(RuleIdentifier.data()+1, "oist_logic_op_with_same_opcode_hands", 36) != 0) |
697 | break; |
698 | return 40; // "hoist_logic_op_with_same_opcode_hands" |
699 | } |
700 | break; |
701 | case 38: // 2 strings to match. |
702 | if (memcmp(RuleIdentifier.data()+0, "combine_f", 9) != 0) |
703 | break; |
704 | switch (RuleIdentifier[9]) { |
705 | default: break; |
706 | case 'a': // 1 string to match. |
707 | if (memcmp(RuleIdentifier.data()+10, "dd_fpext_fmul_to_fmad_or_fma", 28) != 0) |
708 | break; |
709 | return 98; // "combine_fadd_fpext_fmul_to_fmad_or_fma" |
710 | case 's': // 1 string to match. |
711 | if (memcmp(RuleIdentifier.data()+10, "ub_fpext_fmul_to_fmad_or_fma", 28) != 0) |
712 | break; |
713 | return 103; // "combine_fsub_fpext_fmul_to_fmad_or_fma" |
714 | } |
715 | break; |
716 | case 42: // 1 string to match. |
717 | if (memcmp(RuleIdentifier.data()+0, "combine_fadd_fpext_fma_fmul_to_fmad_or_fma", 42) != 0) |
718 | break; |
719 | return 100; // "combine_fadd_fpext_fma_fmul_to_fmad_or_fma" |
720 | case 43: // 1 string to match. |
721 | if (memcmp(RuleIdentifier.data()+0, "combine_fsub_fpext_fneg_fmul_to_fmad_or_fma", 43) != 0) |
722 | break; |
723 | return 104; // "combine_fsub_fpext_fneg_fmul_to_fmad_or_fma" |
724 | } |
725 | #endif // ifndef NDEBUG |
726 | |
727 | return std::nullopt; |
728 | } |
729 | static std::optional<std::pair<uint64_t, uint64_t>> getRuleRangeForIdentifier(StringRef RuleIdentifier) { |
730 | std::pair<StringRef, StringRef> RangePair = RuleIdentifier.split('-'); |
731 | if (!RangePair.second.empty()) { |
732 | const auto First = getRuleIdxForIdentifier(RangePair.first); |
733 | const auto Last = getRuleIdxForIdentifier(RangePair.second); |
734 | if (!First || !Last) |
735 | return std::nullopt; |
736 | if (First >= Last) |
737 | report_fatal_error("Beginning of range should be before end of range"); |
738 | return {{*First, *Last + 1}}; |
739 | } |
740 | if (RangePair.first == "*") { |
741 | return {{0, 114}}; |
742 | } |
743 | const auto I = getRuleIdxForIdentifier(RangePair.first); |
744 | if (!I) |
745 | return std::nullopt; |
746 | return {{*I, *I + 1}}; |
747 | } |
748 | |
749 | bool AArch64GenPreLegalizerCombinerHelperRuleConfig::setRuleEnabled(StringRef RuleIdentifier) { |
750 | auto MaybeRange = getRuleRangeForIdentifier(RuleIdentifier); |
751 | if (!MaybeRange) |
752 | return false; |
753 | for (auto I = MaybeRange->first; I < MaybeRange->second; ++I) |
754 | DisabledRules.reset(I); |
755 | return true; |
756 | } |
757 | |
758 | bool AArch64GenPreLegalizerCombinerHelperRuleConfig::setRuleDisabled(StringRef RuleIdentifier) { |
759 | auto MaybeRange = getRuleRangeForIdentifier(RuleIdentifier); |
760 | if (!MaybeRange) |
761 | return false; |
762 | for (auto I = MaybeRange->first; I < MaybeRange->second; ++I) |
763 | DisabledRules.set(I); |
764 | return true; |
765 | } |
766 | |
767 | bool AArch64GenPreLegalizerCombinerHelperRuleConfig::isRuleDisabled(unsigned RuleID) const { |
768 | return DisabledRules.test(RuleID); |
769 | } |
770 | #endif // ifdef AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_H |
771 | |
772 | #ifdef AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_CPP |
773 | |
774 | std::vector<std::string> AArch64PreLegalizerCombinerHelperOption; |
775 | cl::list<std::string> AArch64PreLegalizerCombinerHelperDisableOption( |
776 | "aarch64prelegalizercombinerhelper-disable-rule", |
777 | cl::desc("Disable one or more combiner rules temporarily in the AArch64PreLegalizerCombinerHelper pass"), |
778 | cl::CommaSeparated, |
779 | cl::Hidden, |
780 | cl::cat(GICombinerOptionCategory), |
781 | cl::callback([](const std::string &Str) { |
782 | AArch64PreLegalizerCombinerHelperOption.push_back(Str); |
783 | })); |
784 | cl::list<std::string> AArch64PreLegalizerCombinerHelperOnlyEnableOption( |
785 | "aarch64prelegalizercombinerhelper-only-enable-rule", |
786 | cl::desc("Disable all rules in the AArch64PreLegalizerCombinerHelper pass then re-enable the specified ones"), |
787 | cl::Hidden, |
788 | cl::cat(GICombinerOptionCategory), |
789 | cl::callback([](const std::string &CommaSeparatedArg) { |
790 | StringRef Str = CommaSeparatedArg; |
791 | AArch64PreLegalizerCombinerHelperOption.push_back("*"); |
792 | do { |
793 | auto X = Str.split(","); |
794 | AArch64PreLegalizerCombinerHelperOption.push_back(("!" + X.first).str()); |
795 | Str = X.second; |
796 | } while (!Str.empty()); |
797 | })); |
798 | |
799 | bool AArch64GenPreLegalizerCombinerHelperRuleConfig::parseCommandLineOption() { |
800 | for (StringRef Identifier : AArch64PreLegalizerCombinerHelperOption) { |
801 | bool Enabled = Identifier.consume_front("!"); |
802 | if (Enabled && !setRuleEnabled(Identifier)) |
803 | return false; |
804 | if (!Enabled && !setRuleDisabled(Identifier)) |
805 | return false; |
806 | } |
807 | return true; |
808 | } |
809 | |
810 | bool AArch64GenPreLegalizerCombinerHelper::tryCombineAll( |
811 | GISelChangeObserver &Observer, |
812 | MachineInstr &MI, |
813 | MachineIRBuilder &B) const { |
814 | MachineBasicBlock *MBB = MI.getParent(); |
815 | MachineFunction *MF = MBB->getParent(); |
816 | MachineRegisterInfo &MRI = MF->getRegInfo(); |
817 | SmallVector<MachineInstr *, 8> MIs = {&MI}; |
818 | |
819 | (void)MBB; (void)MF; (void)MRI; (void)RuleConfig; |
820 | |
821 | // Match data |
822 | unsigned MatchData1; |
823 | std::pair<Register, bool> MatchData2; |
824 | SmallVector<Register, 4> MatchData5; |
825 | Register MatchData6; |
826 | SmallVector<std::pair<Register, MachineInstr*>> MatchData7; |
827 | PreferredTuple MatchData8; |
828 | std::function<void(MachineIRBuilder &)> MatchData9; |
829 | IndexedLoadStoreMatchInfo MatchData10; |
830 | std::function<void(MachineIRBuilder &)> MatchData21; |
831 | Register MatchData28; |
832 | Register MatchData29; |
833 | Register MatchData30; |
834 | Register MatchData31; |
835 | Register MatchData33; |
836 | Register MatchData34; |
837 | Register MatchData35; |
838 | Register MatchData36; |
839 | MachineInstr* MatchData38; |
840 | std::tuple<Register, Register> MatchData39; |
841 | InstructionStepsMatchInfo MatchData40; |
842 | std::function<void(MachineIRBuilder &)> MatchData42; |
843 | PtrAddChain MatchData43; |
844 | std::tuple<Register, int64_t> MatchData44; |
845 | std::tuple<Register, unsigned> MatchData45; |
846 | RegisterImmPair MatchData46; |
847 | std::function<void(MachineIRBuilder &)> MatchData47; |
848 | unsigned MatchData49; |
849 | std::function<void(MachineIRBuilder &)> MatchData50; |
850 | Register MatchData51; |
851 | Register MatchData53; |
852 | Register MatchData55; |
853 | int64_t MatchData56; |
854 | std::function<void(MachineIRBuilder &)> MatchData57; |
855 | std::tuple<Register, unsigned> MatchData59; |
856 | SmallVector<Register, 4> MatchData60; |
857 | MachineInstr * MatchData61; |
858 | SmallVector<Register, 8> MatchData62; |
859 | SmallVector<APInt, 8> MatchData63; |
860 | Register MatchData66; |
861 | std::pair<Register, unsigned> MatchData67; |
862 | std::pair<MachineInstr*, LLT> MatchData68; |
863 | std::optional<APFloat> MatchData69; |
864 | APInt MatchData70; |
865 | std::function<void(MachineIRBuilder &)> MatchData71; |
866 | std::function<void(MachineIRBuilder &)> MatchData72; |
867 | std::function<void(MachineIRBuilder &)> MatchData73; |
868 | std::function<void(MachineIRBuilder &)> MatchData74; |
869 | std::function<void(MachineIRBuilder &)> MatchData75; |
870 | unsigned MatchData76; |
871 | std::pair<Register, Register> MatchData77; |
872 | RegisterImmPair MatchData79; |
873 | ShiftOfShiftedLogic MatchData80; |
874 | std::function<void(MachineIRBuilder &)> MatchData81; |
875 | MergeTruncStoresInfo MatchData82; |
876 | MachineInstr * MatchData83; |
877 | std::function<void(MachineIRBuilder &)> MatchData84; |
878 | std::function<void(MachineIRBuilder &)> MatchData86; |
879 | std::function<void(MachineIRBuilder &)> MatchData87; |
880 | std::function<void(MachineIRBuilder &)> MatchData88; |
881 | std::function<void(MachineIRBuilder &)> MatchData89; |
882 | APInt MatchData90; |
883 | std::function<void(MachineIRBuilder &)> MatchData91; |
884 | std::function<void(MachineIRBuilder &)> MatchData95; |
885 | std::function<void(MachineIRBuilder &)> MatchData96; |
886 | std::function<void(MachineIRBuilder &)> MatchData97; |
887 | std::function<void(MachineIRBuilder &)> MatchData98; |
888 | std::function<void(MachineIRBuilder &)> MatchData99; |
889 | std::function<void(MachineIRBuilder &)> MatchData100; |
890 | std::function<void(MachineIRBuilder &)> MatchData101; |
891 | std::function<void(MachineIRBuilder &)> MatchData102; |
892 | std::function<void(MachineIRBuilder &)> MatchData103; |
893 | std::function<void(MachineIRBuilder &)> MatchData104; |
894 | unsigned MatchData105; |
895 | std::function<void(MachineIRBuilder &)> MatchData106; |
896 | std::function<void(MachineIRBuilder &)> MatchData107; |
897 | std::function<void(MachineIRBuilder &)> MatchData108; |
898 | Register MatchData109; |
899 | Register MatchData112; |
900 | std::pair<uint64_t, uint64_t> MatchData113; |
901 | |
902 | int Partition = -1; |
903 | Partition = -1; |
904 | switch (MIs[0]->getOpcode()) { |
905 | case TargetOpcode::COPY: Partition = 0; break; |
906 | case TargetOpcode::G_MUL: Partition = 1; break; |
907 | case TargetOpcode::G_ADD: Partition = 2; break; |
908 | case TargetOpcode::G_FREEZE: Partition = 3; break; |
909 | case TargetOpcode::G_FABS: Partition = 4; break; |
910 | case TargetOpcode::G_FCANONICALIZE: Partition = 5; break; |
911 | case TargetOpcode::G_INSERT_VECTOR_ELT: Partition = 6; break; |
912 | case TargetOpcode::G_EXTRACT_VECTOR_ELT: Partition = 7; break; |
913 | case TargetOpcode::G_BUILD_VECTOR: Partition = 8; break; |
914 | case TargetOpcode::G_LOAD: Partition = 9; break; |
915 | case TargetOpcode::G_SEXTLOAD: Partition = 10; break; |
916 | case TargetOpcode::G_ZEXTLOAD: Partition = 11; break; |
917 | case TargetOpcode::G_AND: Partition = 12; break; |
918 | case TargetOpcode::G_STORE: Partition = 13; break; |
919 | case TargetOpcode::G_UITOFP: Partition = 14; break; |
920 | case TargetOpcode::G_SITOFP: Partition = 15; break; |
921 | case TargetOpcode::G_OR: Partition = 16; break; |
922 | case TargetOpcode::G_SHL: Partition = 17; break; |
923 | case TargetOpcode::G_UDIV: Partition = 18; break; |
924 | case TargetOpcode::G_UREM: Partition = 19; break; |
925 | case TargetOpcode::G_ASHR: Partition = 20; break; |
926 | case TargetOpcode::G_LSHR: Partition = 21; break; |
927 | case TargetOpcode::G_ABS: Partition = 22; break; |
928 | case TargetOpcode::G_FPTOSI: Partition = 23; break; |
929 | case TargetOpcode::G_FPTOUI: Partition = 24; break; |
930 | case TargetOpcode::G_SUB: Partition = 25; break; |
931 | case TargetOpcode::G_XOR: Partition = 26; break; |
932 | case TargetOpcode::G_TRUNC: Partition = 27; break; |
933 | case TargetOpcode::G_SHUFFLE_VECTOR: Partition = 28; break; |
934 | case TargetOpcode::G_UNMERGE_VALUES: Partition = 29; break; |
935 | case TargetOpcode::G_SELECT: Partition = 30; break; |
936 | case TargetOpcode::G_PTR_ADD: Partition = 31; break; |
937 | case TargetOpcode::G_ROTL: Partition = 32; break; |
938 | case TargetOpcode::G_ROTR: Partition = 33; break; |
939 | case TargetOpcode::G_SDIV: Partition = 34; break; |
940 | case TargetOpcode::G_SREM: Partition = 35; break; |
941 | case TargetOpcode::G_INTTOPTR: Partition = 36; break; |
942 | case TargetOpcode::G_PTRTOINT: Partition = 37; break; |
943 | case TargetOpcode::G_ANYEXT: Partition = 38; break; |
944 | case TargetOpcode::G_FNEG: Partition = 39; break; |
945 | case TargetOpcode::G_BUILD_VECTOR_TRUNC: Partition = 40; break; |
946 | case TargetOpcode::G_BITCAST: Partition = 41; break; |
947 | case TargetOpcode::G_PHI: Partition = 42; break; |
948 | case TargetOpcode::G_SEXT_INREG: Partition = 43; break; |
949 | case TargetOpcode::G_ZEXT: Partition = 44; break; |
950 | case TargetOpcode::G_ICMP: Partition = 45; break; |
951 | case TargetOpcode::G_SEXT: Partition = 46; break; |
952 | case TargetOpcode::G_BR: Partition = 47; break; |
953 | case TargetOpcode::G_MERGE_VALUES: Partition = 48; break; |
954 | case TargetOpcode::G_FPTRUNC: Partition = 49; break; |
955 | case TargetOpcode::G_FSQRT: Partition = 50; break; |
956 | case TargetOpcode::G_FLOG2: Partition = 51; break; |
957 | case TargetOpcode::G_UMULO: Partition = 52; break; |
958 | case TargetOpcode::G_SMULO: Partition = 53; break; |
959 | case TargetOpcode::G_UADDO: Partition = 54; break; |
960 | case TargetOpcode::G_SADDO: Partition = 55; break; |
961 | case TargetOpcode::G_UADDE: Partition = 56; break; |
962 | case TargetOpcode::G_SADDE: Partition = 57; break; |
963 | case TargetOpcode::G_USUBE: Partition = 58; break; |
964 | case TargetOpcode::G_SSUBE: Partition = 59; break; |
965 | case TargetOpcode::G_FMINNUM: Partition = 60; break; |
966 | case TargetOpcode::G_FMAXNUM: Partition = 61; break; |
967 | case TargetOpcode::G_FMINIMUM: Partition = 62; break; |
968 | case TargetOpcode::G_FMAXIMUM: Partition = 63; break; |
969 | case TargetOpcode::G_SSHLSAT: Partition = 64; break; |
970 | case TargetOpcode::G_USHLSAT: Partition = 65; break; |
971 | case TargetOpcode::G_FSHL: Partition = 66; break; |
972 | case TargetOpcode::G_FSHR: Partition = 67; break; |
973 | case TargetOpcode::G_UMULH: Partition = 68; break; |
974 | case TargetOpcode::G_FADD: Partition = 69; break; |
975 | case TargetOpcode::G_FSUB: Partition = 70; break; |
976 | case TargetOpcode::G_FMUL: Partition = 71; break; |
977 | case TargetOpcode::G_FDIV: Partition = 72; break; |
978 | case TargetOpcode::G_FMAD: Partition = 73; break; |
979 | case TargetOpcode::G_FMA: Partition = 74; break; |
980 | case TargetOpcode::G_SMIN: Partition = 75; break; |
981 | case TargetOpcode::G_SMAX: Partition = 76; break; |
982 | case TargetOpcode::G_UMIN: Partition = 77; break; |
983 | case TargetOpcode::G_UMAX: Partition = 78; break; |
984 | case TargetOpcode::G_FREM: Partition = 79; break; |
985 | case TargetOpcode::G_FCONSTANT: Partition = 80; break; |
986 | case TargetOpcode::G_GLOBAL_VALUE: Partition = 81; break; |
987 | } |
988 | // Default case but without conflicting with potential default case in selection. |
989 | if (Partition == -1) return false; |
990 | if (Partition == 0 /* TargetOpcode::COPY */) { |
991 | // Leaf name: copy_prop |
992 | // Rule: copy_prop |
993 | if (!RuleConfig->isRuleDisabled(0)) { |
994 | if (1 |
995 | && [&]() { |
996 | return Helper.matchCombineCopy(*MIs[0]); |
997 | return true; |
998 | }() ) { |
999 | LLVM_DEBUG(dbgs() << "Applying rule 'copy_prop'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'copy_prop'\n" ; } } while (false); |
1000 | Helper.applyCombineCopy(*MIs[0]); |
1001 | return true; |
1002 | } |
1003 | } |
1004 | return false; |
1005 | } |
1006 | if (Partition == 1 /* TargetOpcode::G_MUL */) { |
1007 | // Leaf name: mul_to_shl |
1008 | // Rule: mul_to_shl |
1009 | if (!RuleConfig->isRuleDisabled(1)) { |
1010 | if (1 |
1011 | && [&]() { |
1012 | return Helper.matchCombineMulToShl(*MIs[0], MatchData1); |
1013 | return true; |
1014 | }() ) { |
1015 | LLVM_DEBUG(dbgs() << "Applying rule 'mul_to_shl'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'mul_to_shl'\n" ; } } while (false); |
1016 | Helper.applyCombineMulToShl(*MIs[0], MatchData1); |
1017 | return true; |
1018 | } |
1019 | } |
1020 | // Leaf name: mul_by_neg_one |
1021 | // Rule: mul_by_neg_one |
1022 | if (!RuleConfig->isRuleDisabled(3)) { |
1023 | if (1 |
1024 | && [&]() { |
1025 | return Helper.matchConstantOp(MIs[0]->getOperand(2), -1); |
1026 | return true; |
1027 | }() ) { |
1028 | LLVM_DEBUG(dbgs() << "Applying rule 'mul_by_neg_one'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'mul_by_neg_one'\n" ; } } while (false); |
1029 | Helper.applyCombineMulByNegativeOne(*MIs[0]); |
1030 | return true; |
1031 | } |
1032 | } |
1033 | // Leaf name: undef_to_int_zero |
1034 | // Rule: undef_to_int_zero |
1035 | if (!RuleConfig->isRuleDisabled(12)) { |
1036 | if (1 |
1037 | && [&]() { |
1038 | return Helper.matchAnyExplicitUseIsUndef(*MIs[0]); |
1039 | return true; |
1040 | }() ) { |
1041 | LLVM_DEBUG(dbgs() << "Applying rule 'undef_to_int_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'undef_to_int_zero'\n" ; } } while (false); |
1042 | Helper.replaceInstWithConstant(*MIs[0], 0); |
1043 | return true; |
1044 | } |
1045 | } |
1046 | // Leaf name: binop_right_to_zero |
1047 | // Rule: binop_right_to_zero |
1048 | if (!RuleConfig->isRuleDisabled(27)) { |
1049 | if (1 |
1050 | && [&]() { |
1051 | return Helper.matchOperandIsZero(*MIs[0], 2); |
1052 | return true; |
1053 | }() ) { |
1054 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_right_to_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_right_to_zero'\n" ; } } while (false); |
1055 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 2); |
1056 | return true; |
1057 | } |
1058 | } |
1059 | // Leaf name: right_identity_one |
1060 | // Rule: right_identity_one |
1061 | if (!RuleConfig->isRuleDisabled(32)) { |
1062 | if (1 |
1063 | && [&]() { |
1064 | return Helper.matchConstantOp(MIs[0]->getOperand(2), 1); |
1065 | return true; |
1066 | }() ) { |
1067 | LLVM_DEBUG(dbgs() << "Applying rule 'right_identity_one'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'right_identity_one'\n" ; } } while (false); |
1068 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
1069 | return true; |
1070 | } |
1071 | } |
1072 | // Leaf name: constant_fold |
1073 | // Rule: constant_fold |
1074 | if (!RuleConfig->isRuleDisabled(90)) { |
1075 | if (1 |
1076 | && [&]() { |
1077 | return Helper.matchConstantFold(*MIs[0], MatchData90); |
1078 | return true; |
1079 | }() ) { |
1080 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fold'\n" ; } } while (false); |
1081 | Helper.replaceInstWithConstant(*MIs[0], MatchData90); |
1082 | return true; |
1083 | } |
1084 | } |
1085 | // Leaf name: commute_constant_to_rhs |
1086 | // Rule: commute_constant_to_rhs |
1087 | if (!RuleConfig->isRuleDisabled(110)) { |
1088 | if (1 |
1089 | && [&]() { |
1090 | |
1091 | return getIConstantVRegVal(MIs[0]->getOperand(1).getReg(), MRI).has_value(); |
1092 | |
1093 | return true; |
1094 | }() ) { |
1095 | LLVM_DEBUG(dbgs() << "Applying rule 'commute_constant_to_rhs'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'commute_constant_to_rhs'\n" ; } } while (false); |
1096 | |
1097 | Observer.changingInstr(*MIs[0]); |
1098 | Register LHSReg = MIs[0]->getOperand(1).getReg(); |
1099 | Register RHSReg = MIs[0]->getOperand(2).getReg(); |
1100 | MIs[0]->getOperand(1).setReg(RHSReg); |
1101 | MIs[0]->getOperand(2).setReg(LHSReg); |
1102 | Observer.changedInstr(*MIs[0]); |
1103 | |
1104 | return true; |
1105 | } |
1106 | } |
1107 | return false; |
1108 | } |
1109 | if (Partition == 2 /* TargetOpcode::G_ADD */) { |
1110 | // Leaf name: add_p2i_to_ptradd |
1111 | // Rule: add_p2i_to_ptradd |
1112 | if (!RuleConfig->isRuleDisabled(2)) { |
1113 | if (1 |
1114 | && [&]() { |
1115 | return Helper.matchCombineAddP2IToPtrAdd(*MIs[0], MatchData2); |
1116 | return true; |
1117 | }() ) { |
1118 | LLVM_DEBUG(dbgs() << "Applying rule 'add_p2i_to_ptradd'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'add_p2i_to_ptradd'\n" ; } } while (false); |
1119 | Helper.applyCombineAddP2IToPtrAdd(*MIs[0], MatchData2); |
1120 | return true; |
1121 | } |
1122 | } |
1123 | // Leaf name: propagate_undef_any_op |
1124 | // Rule: propagate_undef_any_op |
1125 | if (!RuleConfig->isRuleDisabled(17)) { |
1126 | if (1 |
1127 | && [&]() { |
1128 | return Helper.matchAnyExplicitUseIsUndef(*MIs[0]); |
1129 | return true; |
1130 | }() ) { |
1131 | LLVM_DEBUG(dbgs() << "Applying rule 'propagate_undef_any_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'propagate_undef_any_op'\n" ; } } while (false); |
1132 | Helper.replaceInstWithUndef(*MIs[0]); |
1133 | return true; |
1134 | } |
1135 | } |
1136 | // Leaf name: right_identity_zero |
1137 | // Rule: right_identity_zero |
1138 | if (!RuleConfig->isRuleDisabled(24)) { |
1139 | if (1 |
1140 | && [&]() { |
1141 | return Helper.matchConstantOp(MIs[0]->getOperand(2), 0); |
1142 | return true; |
1143 | }() ) { |
1144 | LLVM_DEBUG(dbgs() << "Applying rule 'right_identity_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'right_identity_zero'\n" ; } } while (false); |
1145 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
1146 | return true; |
1147 | } |
1148 | } |
1149 | // Leaf name: add_sub_reg |
1150 | // Rule: add_sub_reg |
1151 | if (!RuleConfig->isRuleDisabled(33)) { |
1152 | if (1 |
1153 | && [&]() { |
1154 | return Helper.matchAddSubSameReg(*MIs[0], MatchData33); |
1155 | return true; |
1156 | }() ) { |
1157 | LLVM_DEBUG(dbgs() << "Applying rule 'add_sub_reg'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'add_sub_reg'\n" ; } } while (false); |
1158 | return Helper.replaceSingleDefInstWithReg(*MIs[0], |
1159 | MatchData33); |
1160 | return true; |
1161 | } |
1162 | } |
1163 | // Leaf name: simplify_add_to_sub |
1164 | // Rule: simplify_add_to_sub |
1165 | if (!RuleConfig->isRuleDisabled(39)) { |
1166 | if (1 |
1167 | && [&]() { |
1168 | return Helper.matchSimplifyAddToSub(*MIs[0], MatchData39); |
1169 | return true; |
1170 | }() ) { |
1171 | LLVM_DEBUG(dbgs() << "Applying rule 'simplify_add_to_sub'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'simplify_add_to_sub'\n" ; } } while (false); |
1172 | Helper.applySimplifyAddToSub(*MIs[0], MatchData39); |
1173 | return true; |
1174 | } |
1175 | } |
1176 | // Leaf name: constant_fold |
1177 | // Rule: constant_fold |
1178 | if (!RuleConfig->isRuleDisabled(90)) { |
1179 | if (1 |
1180 | && [&]() { |
1181 | return Helper.matchConstantFold(*MIs[0], MatchData90); |
1182 | return true; |
1183 | }() ) { |
1184 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fold'\n" ; } } while (false); |
1185 | Helper.replaceInstWithConstant(*MIs[0], MatchData90); |
1186 | return true; |
1187 | } |
1188 | } |
1189 | // Leaf name: fold_binop_into_select |
1190 | // Rule: fold_binop_into_select |
1191 | if (!RuleConfig->isRuleDisabled(105)) { |
1192 | if (1 |
1193 | && [&]() { |
1194 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
1195 | return true; |
1196 | }() ) { |
1197 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
1198 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
1199 | return true; |
1200 | } |
1201 | } |
1202 | // Leaf name: commute_constant_to_rhs |
1203 | // Rule: commute_constant_to_rhs |
1204 | if (!RuleConfig->isRuleDisabled(110)) { |
1205 | if (1 |
1206 | && [&]() { |
1207 | |
1208 | return getIConstantVRegVal(MIs[0]->getOperand(1).getReg(), MRI).has_value(); |
1209 | |
1210 | return true; |
1211 | }() ) { |
1212 | LLVM_DEBUG(dbgs() << "Applying rule 'commute_constant_to_rhs'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'commute_constant_to_rhs'\n" ; } } while (false); |
1213 | |
1214 | Observer.changingInstr(*MIs[0]); |
1215 | Register LHSReg = MIs[0]->getOperand(1).getReg(); |
1216 | Register RHSReg = MIs[0]->getOperand(2).getReg(); |
1217 | MIs[0]->getOperand(1).setReg(RHSReg); |
1218 | MIs[0]->getOperand(2).setReg(LHSReg); |
1219 | Observer.changedInstr(*MIs[0]); |
1220 | |
1221 | return true; |
1222 | } |
1223 | } |
1224 | return false; |
1225 | } |
1226 | if (Partition == 3 /* TargetOpcode::G_FREEZE */) { |
1227 | // Leaf name: idempotent_prop |
1228 | // Rule: idempotent_prop |
1229 | if (!RuleConfig->isRuleDisabled(4)) { |
1230 | if (1 |
1231 | && [&]() { |
1232 | return MRI.getVRegDef(MIs[0]->getOperand(1).getReg())->getOpcode() == |
1233 | MIs[0]->getOpcode(); |
1234 | return true; |
1235 | }() ) { |
1236 | LLVM_DEBUG(dbgs() << "Applying rule 'idempotent_prop'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'idempotent_prop'\n" ; } } while (false); |
1237 | Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
1238 | return true; |
1239 | } |
1240 | } |
1241 | return false; |
1242 | } |
1243 | if (Partition == 4 /* TargetOpcode::G_FABS */) { |
1244 | // Leaf name: idempotent_prop |
1245 | // Rule: idempotent_prop |
1246 | if (!RuleConfig->isRuleDisabled(4)) { |
1247 | if (1 |
1248 | && [&]() { |
1249 | return MRI.getVRegDef(MIs[0]->getOperand(1).getReg())->getOpcode() == |
1250 | MIs[0]->getOpcode(); |
1251 | return true; |
1252 | }() ) { |
1253 | LLVM_DEBUG(dbgs() << "Applying rule 'idempotent_prop'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'idempotent_prop'\n" ; } } while (false); |
1254 | Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
1255 | return true; |
1256 | } |
1257 | } |
1258 | // Leaf name: constant_fp_op |
1259 | // Rule: constant_fp_op |
1260 | if (!RuleConfig->isRuleDisabled(69)) { |
1261 | if (1 |
1262 | && [&]() { |
1263 | return Helper.matchCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
1264 | return true; |
1265 | }() ) { |
1266 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fp_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fp_op'\n" ; } } while (false); |
1267 | Helper.applyCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
1268 | return true; |
1269 | } |
1270 | } |
1271 | // Leaf name: fabs_fneg_fold |
1272 | // Rule: fabs_fneg_fold |
1273 | if (!RuleConfig->isRuleDisabled(91)) { |
1274 | if (1 |
1275 | && [&]() { |
1276 | return Helper.matchCombineFAbsOfFNeg(*MIs[0], MatchData91); |
1277 | return true; |
1278 | }() ) { |
1279 | LLVM_DEBUG(dbgs() << "Applying rule 'fabs_fneg_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fabs_fneg_fold'\n" ; } } while (false); |
1280 | Helper.applyBuildFnNoErase(*MIs[0], MatchData91); |
1281 | return true; |
1282 | } |
1283 | } |
1284 | return false; |
1285 | } |
1286 | if (Partition == 5 /* TargetOpcode::G_FCANONICALIZE */) { |
1287 | // Leaf name: idempotent_prop |
1288 | // Rule: idempotent_prop |
1289 | if (!RuleConfig->isRuleDisabled(4)) { |
1290 | if (1 |
1291 | && [&]() { |
1292 | return MRI.getVRegDef(MIs[0]->getOperand(1).getReg())->getOpcode() == |
1293 | MIs[0]->getOpcode(); |
1294 | return true; |
1295 | }() ) { |
1296 | LLVM_DEBUG(dbgs() << "Applying rule 'idempotent_prop'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'idempotent_prop'\n" ; } } while (false); |
1297 | Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
1298 | return true; |
1299 | } |
1300 | } |
1301 | return false; |
1302 | } |
1303 | if (Partition == 6 /* TargetOpcode::G_INSERT_VECTOR_ELT */) { |
1304 | // Leaf name: combine_insert_vec_elts_build_vector |
1305 | // Rule: combine_insert_vec_elts_build_vector |
1306 | if (!RuleConfig->isRuleDisabled(5)) { |
1307 | if (1 |
1308 | && [&]() { |
1309 | return Helper.matchCombineInsertVecElts(*MIs[0], MatchData5); |
1310 | return true; |
1311 | }() ) { |
1312 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_insert_vec_elts_build_vector'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_insert_vec_elts_build_vector'\n" ; } } while (false); |
1313 | Helper.applyCombineInsertVecElts(*MIs[0], MatchData5); |
1314 | return true; |
1315 | } |
1316 | } |
1317 | // Leaf name: insert_extract_vec_elt_out_of_bounds |
1318 | // Rule: insert_extract_vec_elt_out_of_bounds |
1319 | if (!RuleConfig->isRuleDisabled(22)) { |
1320 | if (1 |
1321 | && [&]() { |
1322 | return Helper.matchInsertExtractVecEltOutOfBounds(*MIs[0]); |
1323 | return true; |
1324 | }() ) { |
1325 | LLVM_DEBUG(dbgs() << "Applying rule 'insert_extract_vec_elt_out_of_bounds'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'insert_extract_vec_elt_out_of_bounds'\n" ; } } while (false); |
1326 | Helper.replaceInstWithUndef(*MIs[0]); |
1327 | return true; |
1328 | } |
1329 | } |
1330 | return false; |
1331 | } |
1332 | if (Partition == 7 /* TargetOpcode::G_EXTRACT_VECTOR_ELT */) { |
1333 | // Leaf name: extract_vec_elt_build_vec |
1334 | // Rule: extract_vec_elt_build_vec |
1335 | if (!RuleConfig->isRuleDisabled(6)) { |
1336 | if (1 |
1337 | && [&]() { |
1338 | return Helper.matchExtractVecEltBuildVec(*MIs[0], MatchData6); |
1339 | return true; |
1340 | }() ) { |
1341 | LLVM_DEBUG(dbgs() << "Applying rule 'extract_vec_elt_build_vec'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'extract_vec_elt_build_vec'\n" ; } } while (false); |
1342 | Helper.applyExtractVecEltBuildVec(*MIs[0], MatchData6); |
1343 | return true; |
1344 | } |
1345 | } |
1346 | // Leaf name: insert_extract_vec_elt_out_of_bounds |
1347 | // Rule: insert_extract_vec_elt_out_of_bounds |
1348 | if (!RuleConfig->isRuleDisabled(22)) { |
1349 | if (1 |
1350 | && [&]() { |
1351 | return Helper.matchInsertExtractVecEltOutOfBounds(*MIs[0]); |
1352 | return true; |
1353 | }() ) { |
1354 | LLVM_DEBUG(dbgs() << "Applying rule 'insert_extract_vec_elt_out_of_bounds'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'insert_extract_vec_elt_out_of_bounds'\n" ; } } while (false); |
1355 | Helper.replaceInstWithUndef(*MIs[0]); |
1356 | return true; |
1357 | } |
1358 | } |
1359 | return false; |
1360 | } |
1361 | if (Partition == 8 /* TargetOpcode::G_BUILD_VECTOR */) { |
1362 | // Leaf name: extract_all_elts_from_build_vector |
1363 | // Rule: extract_all_elts_from_build_vector |
1364 | if (!RuleConfig->isRuleDisabled(7)) { |
1365 | if (1 |
1366 | && [&]() { |
1367 | return Helper.matchExtractAllEltsFromBuildVector(*MIs[0], MatchData7); |
1368 | return true; |
1369 | }() ) { |
1370 | LLVM_DEBUG(dbgs() << "Applying rule 'extract_all_elts_from_build_vector'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'extract_all_elts_from_build_vector'\n" ; } } while (false); |
1371 | Helper.applyExtractAllEltsFromBuildVector(*MIs[0], MatchData7); |
1372 | return true; |
1373 | } |
1374 | } |
1375 | // Leaf name: buildvector_identity_fold |
1376 | // Rule: buildvector_identity_fold |
1377 | if (!RuleConfig->isRuleDisabled(34)) { |
1378 | if (1 |
1379 | && [&]() { |
1380 | return Helper.matchBuildVectorIdentityFold(*MIs[0], MatchData34); |
1381 | return true; |
1382 | }() ) { |
1383 | LLVM_DEBUG(dbgs() << "Applying rule 'buildvector_identity_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'buildvector_identity_fold'\n" ; } } while (false); |
1384 | Helper.replaceSingleDefInstWithReg(*MIs[0], MatchData34); |
1385 | return true; |
1386 | } |
1387 | } |
1388 | return false; |
1389 | } |
1390 | if (Partition == 9 /* TargetOpcode::G_LOAD */) { |
1391 | // Leaf name: extending_loads |
1392 | // Rule: extending_loads |
1393 | if (!RuleConfig->isRuleDisabled(8)) { |
1394 | if (1 |
1395 | && [&]() { |
1396 | return Helper.matchCombineExtendingLoads(*MIs[0], MatchData8); |
1397 | return true; |
1398 | }() ) { |
1399 | LLVM_DEBUG(dbgs() << "Applying rule 'extending_loads'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'extending_loads'\n" ; } } while (false); |
1400 | Helper.applyCombineExtendingLoads(*MIs[0], MatchData8); |
1401 | return true; |
1402 | } |
1403 | } |
1404 | // Leaf name: combine_indexed_load_store |
1405 | // Rule: combine_indexed_load_store |
1406 | if (!RuleConfig->isRuleDisabled(10)) { |
1407 | if (1 |
1408 | && [&]() { |
1409 | return Helper.matchCombineIndexedLoadStore(*MIs[0], MatchData10); |
1410 | return true; |
1411 | }() ) { |
1412 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_indexed_load_store'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_indexed_load_store'\n" ; } } while (false); |
1413 | Helper.applyCombineIndexedLoadStore(*MIs[0], MatchData10); |
1414 | return true; |
1415 | } |
1416 | } |
1417 | return false; |
1418 | } |
1419 | if (Partition == 10 /* TargetOpcode::G_SEXTLOAD */) { |
1420 | // Leaf name: extending_loads |
1421 | // Rule: extending_loads |
1422 | if (!RuleConfig->isRuleDisabled(8)) { |
1423 | if (1 |
1424 | && [&]() { |
1425 | return Helper.matchCombineExtendingLoads(*MIs[0], MatchData8); |
1426 | return true; |
1427 | }() ) { |
1428 | LLVM_DEBUG(dbgs() << "Applying rule 'extending_loads'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'extending_loads'\n" ; } } while (false); |
1429 | Helper.applyCombineExtendingLoads(*MIs[0], MatchData8); |
1430 | return true; |
1431 | } |
1432 | } |
1433 | // Leaf name: combine_indexed_load_store |
1434 | // Rule: combine_indexed_load_store |
1435 | if (!RuleConfig->isRuleDisabled(10)) { |
1436 | if (1 |
1437 | && [&]() { |
1438 | return Helper.matchCombineIndexedLoadStore(*MIs[0], MatchData10); |
1439 | return true; |
1440 | }() ) { |
1441 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_indexed_load_store'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_indexed_load_store'\n" ; } } while (false); |
1442 | Helper.applyCombineIndexedLoadStore(*MIs[0], MatchData10); |
1443 | return true; |
1444 | } |
1445 | } |
1446 | return false; |
1447 | } |
1448 | if (Partition == 11 /* TargetOpcode::G_ZEXTLOAD */) { |
1449 | // Leaf name: extending_loads |
1450 | // Rule: extending_loads |
1451 | if (!RuleConfig->isRuleDisabled(8)) { |
1452 | if (1 |
1453 | && [&]() { |
1454 | return Helper.matchCombineExtendingLoads(*MIs[0], MatchData8); |
1455 | return true; |
1456 | }() ) { |
1457 | LLVM_DEBUG(dbgs() << "Applying rule 'extending_loads'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'extending_loads'\n" ; } } while (false); |
1458 | Helper.applyCombineExtendingLoads(*MIs[0], MatchData8); |
1459 | return true; |
1460 | } |
1461 | } |
1462 | // Leaf name: combine_indexed_load_store |
1463 | // Rule: combine_indexed_load_store |
1464 | if (!RuleConfig->isRuleDisabled(10)) { |
1465 | if (1 |
1466 | && [&]() { |
1467 | return Helper.matchCombineIndexedLoadStore(*MIs[0], MatchData10); |
1468 | return true; |
1469 | }() ) { |
1470 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_indexed_load_store'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_indexed_load_store'\n" ; } } while (false); |
1471 | Helper.applyCombineIndexedLoadStore(*MIs[0], MatchData10); |
1472 | return true; |
1473 | } |
1474 | } |
1475 | return false; |
1476 | } |
1477 | if (Partition == 12 /* TargetOpcode::G_AND */) { |
1478 | // Leaf name: load_and_mask |
1479 | // Rule: load_and_mask |
1480 | if (!RuleConfig->isRuleDisabled(9)) { |
1481 | if (1 |
1482 | && [&]() { |
1483 | return Helper.matchCombineLoadWithAndMask(*MIs[0], MatchData9); |
1484 | return true; |
1485 | }() ) { |
1486 | LLVM_DEBUG(dbgs() << "Applying rule 'load_and_mask'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'load_and_mask'\n" ; } } while (false); |
1487 | Helper.applyBuildFn(*MIs[0], MatchData9); |
1488 | return true; |
1489 | } |
1490 | } |
1491 | // Leaf name: undef_to_int_zero |
1492 | // Rule: undef_to_int_zero |
1493 | if (!RuleConfig->isRuleDisabled(12)) { |
1494 | if (1 |
1495 | && [&]() { |
1496 | return Helper.matchAnyExplicitUseIsUndef(*MIs[0]); |
1497 | return true; |
1498 | }() ) { |
1499 | LLVM_DEBUG(dbgs() << "Applying rule 'undef_to_int_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'undef_to_int_zero'\n" ; } } while (false); |
1500 | Helper.replaceInstWithConstant(*MIs[0], 0); |
1501 | return true; |
1502 | } |
1503 | } |
1504 | // Leaf name: binop_same_val |
1505 | // Rule: binop_same_val |
1506 | if (!RuleConfig->isRuleDisabled(25)) { |
1507 | if (1 |
1508 | && [&]() { |
1509 | return Helper.matchBinOpSameVal(*MIs[0]); |
1510 | return true; |
1511 | }() ) { |
1512 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_same_val'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_same_val'\n" ; } } while (false); |
1513 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
1514 | return true; |
1515 | } |
1516 | } |
1517 | // Leaf name: hoist_logic_op_with_same_opcode_hands |
1518 | // Rule: hoist_logic_op_with_same_opcode_hands |
1519 | if (!RuleConfig->isRuleDisabled(40)) { |
1520 | if (1 |
1521 | && [&]() { |
1522 | return Helper.matchHoistLogicOpWithSameOpcodeHands(*MIs[0], MatchData40); |
1523 | return true; |
1524 | }() ) { |
1525 | LLVM_DEBUG(dbgs() << "Applying rule 'hoist_logic_op_with_same_opcode_hands'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'hoist_logic_op_with_same_opcode_hands'\n" ; } } while (false); |
1526 | Helper.applyBuildInstructionSteps(*MIs[0], MatchData40); |
1527 | return true; |
1528 | } |
1529 | } |
1530 | // Leaf name: narrow_binop_feeding_and |
1531 | // Rule: narrow_binop_feeding_and |
1532 | if (!RuleConfig->isRuleDisabled(47)) { |
1533 | if (1 |
1534 | && [&]() { |
1535 | return Helper.matchNarrowBinopFeedingAnd(*MIs[0], MatchData47); |
1536 | return true; |
1537 | }() ) { |
1538 | LLVM_DEBUG(dbgs() << "Applying rule 'narrow_binop_feeding_and'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'narrow_binop_feeding_and'\n" ; } } while (false); |
1539 | Helper.applyBuildFnNoErase(*MIs[0], MatchData47); |
1540 | return true; |
1541 | } |
1542 | } |
1543 | // Leaf name: redundant_and |
1544 | // Rule: redundant_and |
1545 | if (!RuleConfig->isRuleDisabled(51)) { |
1546 | if (1 |
1547 | && [&]() { |
1548 | return Helper.matchRedundantAnd(*MIs[0], MatchData51); |
1549 | return true; |
1550 | }() ) { |
1551 | LLVM_DEBUG(dbgs() << "Applying rule 'redundant_and'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'redundant_and'\n" ; } } while (false); |
1552 | return Helper.replaceSingleDefInstWithReg(*MIs[0], MatchData51); |
1553 | return true; |
1554 | } |
1555 | } |
1556 | // Leaf name: overlapping_and |
1557 | // Rule: overlapping_and |
1558 | if (!RuleConfig->isRuleDisabled(71)) { |
1559 | if (1 |
1560 | && [&]() { |
1561 | return Helper.matchOverlappingAnd(*MIs[0], MatchData71); |
1562 | return true; |
1563 | }() ) { |
1564 | LLVM_DEBUG(dbgs() << "Applying rule 'overlapping_and'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'overlapping_and'\n" ; } } while (false); |
1565 | Helper.applyBuildFn(*MIs[0], MatchData71); |
1566 | return true; |
1567 | } |
1568 | } |
1569 | // Leaf name: bitfield_extract_from_and |
1570 | // Rule: bitfield_extract_from_and |
1571 | if (!RuleConfig->isRuleDisabled(87)) { |
1572 | if (1 |
1573 | && [&]() { |
1574 | return Helper.matchBitfieldExtractFromAnd(*MIs[0], MatchData87); |
1575 | return true; |
1576 | }() ) { |
1577 | LLVM_DEBUG(dbgs() << "Applying rule 'bitfield_extract_from_and'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'bitfield_extract_from_and'\n" ; } } while (false); |
1578 | Helper.applyBuildFn(*MIs[0], MatchData87); |
1579 | return true; |
1580 | } |
1581 | } |
1582 | // Leaf name: constant_fold |
1583 | // Rule: constant_fold |
1584 | if (!RuleConfig->isRuleDisabled(90)) { |
1585 | if (1 |
1586 | && [&]() { |
1587 | return Helper.matchConstantFold(*MIs[0], MatchData90); |
1588 | return true; |
1589 | }() ) { |
1590 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fold'\n" ; } } while (false); |
1591 | Helper.replaceInstWithConstant(*MIs[0], MatchData90); |
1592 | return true; |
1593 | } |
1594 | } |
1595 | // Leaf name: and_or_disjoint_mask |
1596 | // Rule: and_or_disjoint_mask |
1597 | if (!RuleConfig->isRuleDisabled(96)) { |
1598 | if (1 |
1599 | && [&]() { |
1600 | return Helper.matchAndOrDisjointMask(*MIs[0], MatchData96); |
1601 | return true; |
1602 | }() ) { |
1603 | LLVM_DEBUG(dbgs() << "Applying rule 'and_or_disjoint_mask'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'and_or_disjoint_mask'\n" ; } } while (false); |
1604 | Helper.applyBuildFnNoErase(*MIs[0], MatchData96); |
1605 | return true; |
1606 | } |
1607 | } |
1608 | // Leaf name: fold_binop_into_select |
1609 | // Rule: fold_binop_into_select |
1610 | if (!RuleConfig->isRuleDisabled(105)) { |
1611 | if (1 |
1612 | && [&]() { |
1613 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
1614 | return true; |
1615 | }() ) { |
1616 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
1617 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
1618 | return true; |
1619 | } |
1620 | } |
1621 | // Leaf name: commute_constant_to_rhs |
1622 | // Rule: commute_constant_to_rhs |
1623 | if (!RuleConfig->isRuleDisabled(110)) { |
1624 | if (1 |
1625 | && [&]() { |
1626 | |
1627 | return getIConstantVRegVal(MIs[0]->getOperand(1).getReg(), MRI).has_value(); |
1628 | |
1629 | return true; |
1630 | }() ) { |
1631 | LLVM_DEBUG(dbgs() << "Applying rule 'commute_constant_to_rhs'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'commute_constant_to_rhs'\n" ; } } while (false); |
1632 | |
1633 | Observer.changingInstr(*MIs[0]); |
1634 | Register LHSReg = MIs[0]->getOperand(1).getReg(); |
1635 | Register RHSReg = MIs[0]->getOperand(2).getReg(); |
1636 | MIs[0]->getOperand(1).setReg(RHSReg); |
1637 | MIs[0]->getOperand(2).setReg(LHSReg); |
1638 | Observer.changedInstr(*MIs[0]); |
1639 | |
1640 | return true; |
1641 | } |
1642 | } |
1643 | return false; |
1644 | } |
1645 | if (Partition == 13 /* TargetOpcode::G_STORE */) { |
1646 | // Leaf name: combine_indexed_load_store |
1647 | // Rule: combine_indexed_load_store |
1648 | if (!RuleConfig->isRuleDisabled(10)) { |
1649 | if (1 |
1650 | && [&]() { |
1651 | return Helper.matchCombineIndexedLoadStore(*MIs[0], MatchData10); |
1652 | return true; |
1653 | }() ) { |
1654 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_indexed_load_store'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_indexed_load_store'\n" ; } } while (false); |
1655 | Helper.applyCombineIndexedLoadStore(*MIs[0], MatchData10); |
1656 | return true; |
1657 | } |
1658 | } |
1659 | // Leaf name: erase_undef_store |
1660 | // Rule: erase_undef_store |
1661 | if (!RuleConfig->isRuleDisabled(20)) { |
1662 | if (1 |
1663 | && [&]() { |
1664 | return Helper.matchUndefStore(*MIs[0]); |
1665 | return true; |
1666 | }() ) { |
1667 | LLVM_DEBUG(dbgs() << "Applying rule 'erase_undef_store'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'erase_undef_store'\n" ; } } while (false); |
1668 | return Helper.eraseInst(*MIs[0]); |
1669 | return true; |
1670 | } |
1671 | } |
1672 | // Leaf name: truncstore_merge |
1673 | // Rule: truncstore_merge |
1674 | if (!RuleConfig->isRuleDisabled(82)) { |
1675 | if (1 |
1676 | && [&]() { |
1677 | return Helper.matchTruncStoreMerge(*MIs[0], MatchData82); |
1678 | return true; |
1679 | }() ) { |
1680 | LLVM_DEBUG(dbgs() << "Applying rule 'truncstore_merge'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'truncstore_merge'\n" ; } } while (false); |
1681 | Helper.applyTruncStoreMerge(*MIs[0], MatchData82); |
1682 | return true; |
1683 | } |
1684 | } |
1685 | return false; |
1686 | } |
1687 | if (Partition == 14 /* TargetOpcode::G_UITOFP */) { |
1688 | // Leaf name: undef_to_fp_zero |
1689 | // Rule: undef_to_fp_zero |
1690 | if (!RuleConfig->isRuleDisabled(11)) { |
1691 | if (1 |
1692 | && [&]() { |
1693 | return Helper.matchAnyExplicitUseIsUndef(*MIs[0]); |
1694 | return true; |
1695 | }() ) { |
1696 | LLVM_DEBUG(dbgs() << "Applying rule 'undef_to_fp_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'undef_to_fp_zero'\n" ; } } while (false); |
1697 | Helper.replaceInstWithFConstant(*MIs[0], 0.0); |
1698 | return true; |
1699 | } |
1700 | } |
1701 | return false; |
1702 | } |
1703 | if (Partition == 15 /* TargetOpcode::G_SITOFP */) { |
1704 | // Leaf name: undef_to_fp_zero |
1705 | // Rule: undef_to_fp_zero |
1706 | if (!RuleConfig->isRuleDisabled(11)) { |
1707 | if (1 |
1708 | && [&]() { |
1709 | return Helper.matchAnyExplicitUseIsUndef(*MIs[0]); |
1710 | return true; |
1711 | }() ) { |
1712 | LLVM_DEBUG(dbgs() << "Applying rule 'undef_to_fp_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'undef_to_fp_zero'\n" ; } } while (false); |
1713 | Helper.replaceInstWithFConstant(*MIs[0], 0.0); |
1714 | return true; |
1715 | } |
1716 | } |
1717 | return false; |
1718 | } |
1719 | if (Partition == 16 /* TargetOpcode::G_OR */) { |
1720 | // Leaf name: undef_to_negative_one |
1721 | // Rule: undef_to_negative_one |
1722 | if (!RuleConfig->isRuleDisabled(13)) { |
1723 | if (1 |
1724 | && [&]() { |
1725 | return Helper.matchAnyExplicitUseIsUndef(*MIs[0]); |
1726 | return true; |
1727 | }() ) { |
1728 | LLVM_DEBUG(dbgs() << "Applying rule 'undef_to_negative_one'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'undef_to_negative_one'\n" ; } } while (false); |
1729 | Helper.replaceInstWithConstant(*MIs[0], -1); |
1730 | return true; |
1731 | } |
1732 | } |
1733 | // Leaf name: right_identity_zero |
1734 | // Rule: right_identity_zero |
1735 | if (!RuleConfig->isRuleDisabled(24)) { |
1736 | if (1 |
1737 | && [&]() { |
1738 | return Helper.matchConstantOp(MIs[0]->getOperand(2), 0); |
1739 | return true; |
1740 | }() ) { |
1741 | LLVM_DEBUG(dbgs() << "Applying rule 'right_identity_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'right_identity_zero'\n" ; } } while (false); |
1742 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
1743 | return true; |
1744 | } |
1745 | } |
1746 | // Leaf name: binop_same_val |
1747 | // Rule: binop_same_val |
1748 | if (!RuleConfig->isRuleDisabled(25)) { |
1749 | if (1 |
1750 | && [&]() { |
1751 | return Helper.matchBinOpSameVal(*MIs[0]); |
1752 | return true; |
1753 | }() ) { |
1754 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_same_val'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_same_val'\n" ; } } while (false); |
1755 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
1756 | return true; |
1757 | } |
1758 | } |
1759 | // Leaf name: hoist_logic_op_with_same_opcode_hands |
1760 | // Rule: hoist_logic_op_with_same_opcode_hands |
1761 | if (!RuleConfig->isRuleDisabled(40)) { |
1762 | if (1 |
1763 | && [&]() { |
1764 | return Helper.matchHoistLogicOpWithSameOpcodeHands(*MIs[0], MatchData40); |
1765 | return true; |
1766 | }() ) { |
1767 | LLVM_DEBUG(dbgs() << "Applying rule 'hoist_logic_op_with_same_opcode_hands'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'hoist_logic_op_with_same_opcode_hands'\n" ; } } while (false); |
1768 | Helper.applyBuildInstructionSteps(*MIs[0], MatchData40); |
1769 | return true; |
1770 | } |
1771 | } |
1772 | // Leaf name: redundant_or |
1773 | // Rule: redundant_or |
1774 | if (!RuleConfig->isRuleDisabled(53)) { |
1775 | if (1 |
1776 | && [&]() { |
1777 | return Helper.matchRedundantOr(*MIs[0], MatchData53); |
1778 | return true; |
1779 | }() ) { |
1780 | LLVM_DEBUG(dbgs() << "Applying rule 'redundant_or'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'redundant_or'\n" ; } } while (false); |
1781 | return Helper.replaceSingleDefInstWithReg(*MIs[0], MatchData53); |
1782 | return true; |
1783 | } |
1784 | } |
1785 | // Leaf name: load_or_combine |
1786 | // Rule: load_or_combine |
1787 | if (!RuleConfig->isRuleDisabled(81)) { |
1788 | if (1 |
1789 | && [&]() { |
1790 | return Helper.matchLoadOrCombine(*MIs[0], MatchData81); |
1791 | return true; |
1792 | }() ) { |
1793 | LLVM_DEBUG(dbgs() << "Applying rule 'load_or_combine'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'load_or_combine'\n" ; } } while (false); |
1794 | Helper.applyBuildFn(*MIs[0], MatchData81); |
1795 | return true; |
1796 | } |
1797 | } |
1798 | // Leaf name: funnel_shift_from_or_shift |
1799 | // Rule: funnel_shift_from_or_shift |
1800 | if (!RuleConfig->isRuleDisabled(84)) { |
1801 | if (1 |
1802 | && [&]() { |
1803 | return Helper.matchOrShiftToFunnelShift(*MIs[0], MatchData84); |
1804 | return true; |
1805 | }() ) { |
1806 | LLVM_DEBUG(dbgs() << "Applying rule 'funnel_shift_from_or_shift'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'funnel_shift_from_or_shift'\n" ; } } while (false); |
1807 | Helper.applyBuildFn(*MIs[0], MatchData84); |
1808 | return true; |
1809 | } |
1810 | } |
1811 | // Leaf name: constant_fold |
1812 | // Rule: constant_fold |
1813 | if (!RuleConfig->isRuleDisabled(90)) { |
1814 | if (1 |
1815 | && [&]() { |
1816 | return Helper.matchConstantFold(*MIs[0], MatchData90); |
1817 | return true; |
1818 | }() ) { |
1819 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fold'\n" ; } } while (false); |
1820 | Helper.replaceInstWithConstant(*MIs[0], MatchData90); |
1821 | return true; |
1822 | } |
1823 | } |
1824 | // Leaf name: fold_binop_into_select |
1825 | // Rule: fold_binop_into_select |
1826 | if (!RuleConfig->isRuleDisabled(105)) { |
1827 | if (1 |
1828 | && [&]() { |
1829 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
1830 | return true; |
1831 | }() ) { |
1832 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
1833 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
1834 | return true; |
1835 | } |
1836 | } |
1837 | // Leaf name: commute_constant_to_rhs |
1838 | // Rule: commute_constant_to_rhs |
1839 | if (!RuleConfig->isRuleDisabled(110)) { |
1840 | if (1 |
1841 | && [&]() { |
1842 | |
1843 | return getIConstantVRegVal(MIs[0]->getOperand(1).getReg(), MRI).has_value(); |
1844 | |
1845 | return true; |
1846 | }() ) { |
1847 | LLVM_DEBUG(dbgs() << "Applying rule 'commute_constant_to_rhs'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'commute_constant_to_rhs'\n" ; } } while (false); |
1848 | |
1849 | Observer.changingInstr(*MIs[0]); |
1850 | Register LHSReg = MIs[0]->getOperand(1).getReg(); |
1851 | Register RHSReg = MIs[0]->getOperand(2).getReg(); |
1852 | MIs[0]->getOperand(1).setReg(RHSReg); |
1853 | MIs[0]->getOperand(2).setReg(LHSReg); |
1854 | Observer.changedInstr(*MIs[0]); |
1855 | |
1856 | return true; |
1857 | } |
1858 | } |
1859 | return false; |
1860 | } |
1861 | if (Partition == 17 /* TargetOpcode::G_SHL */) { |
1862 | // Leaf name: binop_left_undef_to_zero |
1863 | // Rule: binop_left_undef_to_zero |
1864 | if (!RuleConfig->isRuleDisabled(14)) { |
1865 | if (1 |
1866 | && [&]() { |
1867 | return Helper.matchOperandIsUndef(*MIs[0], 1); |
1868 | return true; |
1869 | }() ) { |
1870 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_left_undef_to_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_left_undef_to_zero'\n" ; } } while (false); |
1871 | Helper.replaceInstWithConstant(*MIs[0], 0); |
1872 | return true; |
1873 | } |
1874 | } |
1875 | // Leaf name: binop_right_undef_to_undef |
1876 | // Rule: binop_right_undef_to_undef |
1877 | if (!RuleConfig->isRuleDisabled(15)) { |
1878 | if (1 |
1879 | && [&]() { |
1880 | return Helper.matchOperandIsUndef(*MIs[0], 2); |
1881 | return true; |
1882 | }() ) { |
1883 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_right_undef_to_undef'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_right_undef_to_undef'\n" ; } } while (false); |
1884 | Helper.replaceInstWithUndef(*MIs[0]); |
1885 | return true; |
1886 | } |
1887 | } |
1888 | // Leaf name: right_identity_zero |
1889 | // Rule: right_identity_zero |
1890 | if (!RuleConfig->isRuleDisabled(24)) { |
1891 | if (1 |
1892 | && [&]() { |
1893 | return Helper.matchConstantOp(MIs[0]->getOperand(2), 0); |
1894 | return true; |
1895 | }() ) { |
1896 | LLVM_DEBUG(dbgs() << "Applying rule 'right_identity_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'right_identity_zero'\n" ; } } while (false); |
1897 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
1898 | return true; |
1899 | } |
1900 | } |
1901 | // Leaf name: shifts_too_big |
1902 | // Rule: shifts_too_big |
1903 | if (!RuleConfig->isRuleDisabled(41)) { |
1904 | if (1 |
1905 | && [&]() { |
1906 | return Helper.matchShiftsTooBig(*MIs[0]); |
1907 | return true; |
1908 | }() ) { |
1909 | LLVM_DEBUG(dbgs() << "Applying rule 'shifts_too_big'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shifts_too_big'\n" ; } } while (false); |
1910 | Helper.replaceInstWithUndef(*MIs[0]); |
1911 | return true; |
1912 | } |
1913 | } |
1914 | // Leaf name: reduce_shl_of_extend |
1915 | // Rule: reduce_shl_of_extend |
1916 | if (!RuleConfig->isRuleDisabled(46)) { |
1917 | if (1 |
1918 | && [&]() { |
1919 | return Helper.matchCombineShlOfExtend(*MIs[0], MatchData46); |
1920 | return true; |
1921 | }() ) { |
1922 | LLVM_DEBUG(dbgs() << "Applying rule 'reduce_shl_of_extend'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'reduce_shl_of_extend'\n" ; } } while (false); |
1923 | Helper.applyCombineShlOfExtend(*MIs[0], MatchData46); |
1924 | return true; |
1925 | } |
1926 | } |
1927 | // Leaf name: shift_immed_chain |
1928 | // Rule: shift_immed_chain |
1929 | if (!RuleConfig->isRuleDisabled(79)) { |
1930 | if (1 |
1931 | && [&]() { |
1932 | return Helper.matchShiftImmedChain(*MIs[0], MatchData79); |
1933 | return true; |
1934 | }() ) { |
1935 | LLVM_DEBUG(dbgs() << "Applying rule 'shift_immed_chain'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shift_immed_chain'\n" ; } } while (false); |
1936 | Helper.applyShiftImmedChain(*MIs[0], MatchData79); |
1937 | return true; |
1938 | } |
1939 | } |
1940 | // Leaf name: shift_of_shifted_logic_chain |
1941 | // Rule: shift_of_shifted_logic_chain |
1942 | if (!RuleConfig->isRuleDisabled(80)) { |
1943 | if (1 |
1944 | && [&]() { |
1945 | return Helper.matchShiftOfShiftedLogic(*MIs[0], MatchData80); |
1946 | return true; |
1947 | }() ) { |
1948 | LLVM_DEBUG(dbgs() << "Applying rule 'shift_of_shifted_logic_chain'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shift_of_shifted_logic_chain'\n" ; } } while (false); |
1949 | Helper.applyShiftOfShiftedLogic(*MIs[0], MatchData80); |
1950 | return true; |
1951 | } |
1952 | } |
1953 | // Leaf name: fold_binop_into_select |
1954 | // Rule: fold_binop_into_select |
1955 | if (!RuleConfig->isRuleDisabled(105)) { |
1956 | if (1 |
1957 | && [&]() { |
1958 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
1959 | return true; |
1960 | }() ) { |
1961 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
1962 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
1963 | return true; |
1964 | } |
1965 | } |
1966 | return false; |
1967 | } |
1968 | if (Partition == 18 /* TargetOpcode::G_UDIV */) { |
1969 | // Leaf name: binop_left_undef_to_zero |
1970 | // Rule: binop_left_undef_to_zero |
1971 | if (!RuleConfig->isRuleDisabled(14)) { |
1972 | if (1 |
1973 | && [&]() { |
1974 | return Helper.matchOperandIsUndef(*MIs[0], 1); |
1975 | return true; |
1976 | }() ) { |
1977 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_left_undef_to_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_left_undef_to_zero'\n" ; } } while (false); |
1978 | Helper.replaceInstWithConstant(*MIs[0], 0); |
1979 | return true; |
1980 | } |
1981 | } |
1982 | // Leaf name: binop_left_to_zero |
1983 | // Rule: binop_left_to_zero |
1984 | if (!RuleConfig->isRuleDisabled(26)) { |
1985 | if (1 |
1986 | && [&]() { |
1987 | return Helper.matchOperandIsZero(*MIs[0], 1); |
1988 | return true; |
1989 | }() ) { |
1990 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_left_to_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_left_to_zero'\n" ; } } while (false); |
1991 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
1992 | return true; |
1993 | } |
1994 | } |
1995 | // Leaf name: div_rem_to_divrem |
1996 | // Rule: div_rem_to_divrem |
1997 | if (!RuleConfig->isRuleDisabled(83)) { |
1998 | if (1 |
1999 | && [&]() { |
2000 | return Helper.matchCombineDivRem(*MIs[0], MatchData83); |
2001 | return true; |
2002 | }() ) { |
2003 | LLVM_DEBUG(dbgs() << "Applying rule 'div_rem_to_divrem'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'div_rem_to_divrem'\n" ; } } while (false); |
2004 | Helper.applyCombineDivRem(*MIs[0], MatchData83); |
2005 | return true; |
2006 | } |
2007 | } |
2008 | // Leaf name: udiv_by_const |
2009 | // Rule: udiv_by_const |
2010 | if (!RuleConfig->isRuleDisabled(92)) { |
2011 | if (1 |
2012 | && [&]() { |
2013 | return Helper.matchUDivByConst(*MIs[0]); |
2014 | return true; |
2015 | }() ) { |
2016 | LLVM_DEBUG(dbgs() << "Applying rule 'udiv_by_const'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'udiv_by_const'\n" ; } } while (false); |
2017 | Helper.applyUDivByConst(*MIs[0]); |
2018 | return true; |
2019 | } |
2020 | } |
2021 | // Leaf name: fold_binop_into_select |
2022 | // Rule: fold_binop_into_select |
2023 | if (!RuleConfig->isRuleDisabled(105)) { |
2024 | if (1 |
2025 | && [&]() { |
2026 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2027 | return true; |
2028 | }() ) { |
2029 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
2030 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2031 | return true; |
2032 | } |
2033 | } |
2034 | return false; |
2035 | } |
2036 | if (Partition == 19 /* TargetOpcode::G_UREM */) { |
2037 | // Leaf name: binop_left_undef_to_zero |
2038 | // Rule: binop_left_undef_to_zero |
2039 | if (!RuleConfig->isRuleDisabled(14)) { |
2040 | if (1 |
2041 | && [&]() { |
2042 | return Helper.matchOperandIsUndef(*MIs[0], 1); |
2043 | return true; |
2044 | }() ) { |
2045 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_left_undef_to_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_left_undef_to_zero'\n" ; } } while (false); |
2046 | Helper.replaceInstWithConstant(*MIs[0], 0); |
2047 | return true; |
2048 | } |
2049 | } |
2050 | // Leaf name: binop_left_to_zero |
2051 | // Rule: binop_left_to_zero |
2052 | if (!RuleConfig->isRuleDisabled(26)) { |
2053 | if (1 |
2054 | && [&]() { |
2055 | return Helper.matchOperandIsZero(*MIs[0], 1); |
2056 | return true; |
2057 | }() ) { |
2058 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_left_to_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_left_to_zero'\n" ; } } while (false); |
2059 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
2060 | return true; |
2061 | } |
2062 | } |
2063 | // Leaf name: urem_pow2_to_mask |
2064 | // Rule: urem_pow2_to_mask |
2065 | if (!RuleConfig->isRuleDisabled(54)) { |
2066 | if (1 |
2067 | && [&]() { |
2068 | return Helper.matchOperandIsKnownToBeAPowerOfTwo(*MIs[0], 2); |
2069 | return true; |
2070 | }() ) { |
2071 | LLVM_DEBUG(dbgs() << "Applying rule 'urem_pow2_to_mask'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'urem_pow2_to_mask'\n" ; } } while (false); |
2072 | Helper.applySimplifyURemByPow2(*MIs[0]); |
2073 | return true; |
2074 | } |
2075 | } |
2076 | // Leaf name: div_rem_to_divrem |
2077 | // Rule: div_rem_to_divrem |
2078 | if (!RuleConfig->isRuleDisabled(83)) { |
2079 | if (1 |
2080 | && [&]() { |
2081 | return Helper.matchCombineDivRem(*MIs[0], MatchData83); |
2082 | return true; |
2083 | }() ) { |
2084 | LLVM_DEBUG(dbgs() << "Applying rule 'div_rem_to_divrem'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'div_rem_to_divrem'\n" ; } } while (false); |
2085 | Helper.applyCombineDivRem(*MIs[0], MatchData83); |
2086 | return true; |
2087 | } |
2088 | } |
2089 | // Leaf name: fold_binop_into_select |
2090 | // Rule: fold_binop_into_select |
2091 | if (!RuleConfig->isRuleDisabled(105)) { |
2092 | if (1 |
2093 | && [&]() { |
2094 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2095 | return true; |
2096 | }() ) { |
2097 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
2098 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2099 | return true; |
2100 | } |
2101 | } |
2102 | return false; |
2103 | } |
2104 | if (Partition == 20 /* TargetOpcode::G_ASHR */) { |
2105 | // Leaf name: binop_right_undef_to_undef |
2106 | // Rule: binop_right_undef_to_undef |
2107 | if (!RuleConfig->isRuleDisabled(15)) { |
2108 | if (1 |
2109 | && [&]() { |
2110 | return Helper.matchOperandIsUndef(*MIs[0], 2); |
2111 | return true; |
2112 | }() ) { |
2113 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_right_undef_to_undef'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_right_undef_to_undef'\n" ; } } while (false); |
2114 | Helper.replaceInstWithUndef(*MIs[0]); |
2115 | return true; |
2116 | } |
2117 | } |
2118 | // Leaf name: right_identity_zero |
2119 | // Rule: right_identity_zero |
2120 | if (!RuleConfig->isRuleDisabled(24)) { |
2121 | if (1 |
2122 | && [&]() { |
2123 | return Helper.matchConstantOp(MIs[0]->getOperand(2), 0); |
2124 | return true; |
2125 | }() ) { |
2126 | LLVM_DEBUG(dbgs() << "Applying rule 'right_identity_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'right_identity_zero'\n" ; } } while (false); |
2127 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
2128 | return true; |
2129 | } |
2130 | } |
2131 | // Leaf name: shifts_too_big |
2132 | // Rule: shifts_too_big |
2133 | if (!RuleConfig->isRuleDisabled(41)) { |
2134 | if (1 |
2135 | && [&]() { |
2136 | return Helper.matchShiftsTooBig(*MIs[0]); |
2137 | return true; |
2138 | }() ) { |
2139 | LLVM_DEBUG(dbgs() << "Applying rule 'shifts_too_big'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shifts_too_big'\n" ; } } while (false); |
2140 | Helper.replaceInstWithUndef(*MIs[0]); |
2141 | return true; |
2142 | } |
2143 | } |
2144 | // Leaf name: shl_ashr_to_sext_inreg |
2145 | // Rule: shl_ashr_to_sext_inreg |
2146 | if (!RuleConfig->isRuleDisabled(44)) { |
2147 | if (1 |
2148 | && [&]() { |
2149 | return Helper.matchAshrShlToSextInreg(*MIs[0], MatchData44); |
2150 | return true; |
2151 | }() ) { |
2152 | LLVM_DEBUG(dbgs() << "Applying rule 'shl_ashr_to_sext_inreg'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shl_ashr_to_sext_inreg'\n" ; } } while (false); |
2153 | Helper.applyAshShlToSextInreg(*MIs[0], MatchData44); |
2154 | return true; |
2155 | } |
2156 | } |
2157 | // Leaf name: shift_immed_chain |
2158 | // Rule: shift_immed_chain |
2159 | if (!RuleConfig->isRuleDisabled(79)) { |
2160 | if (1 |
2161 | && [&]() { |
2162 | return Helper.matchShiftImmedChain(*MIs[0], MatchData79); |
2163 | return true; |
2164 | }() ) { |
2165 | LLVM_DEBUG(dbgs() << "Applying rule 'shift_immed_chain'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shift_immed_chain'\n" ; } } while (false); |
2166 | Helper.applyShiftImmedChain(*MIs[0], MatchData79); |
2167 | return true; |
2168 | } |
2169 | } |
2170 | // Leaf name: shift_of_shifted_logic_chain |
2171 | // Rule: shift_of_shifted_logic_chain |
2172 | if (!RuleConfig->isRuleDisabled(80)) { |
2173 | if (1 |
2174 | && [&]() { |
2175 | return Helper.matchShiftOfShiftedLogic(*MIs[0], MatchData80); |
2176 | return true; |
2177 | }() ) { |
2178 | LLVM_DEBUG(dbgs() << "Applying rule 'shift_of_shifted_logic_chain'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shift_of_shifted_logic_chain'\n" ; } } while (false); |
2179 | Helper.applyShiftOfShiftedLogic(*MIs[0], MatchData80); |
2180 | return true; |
2181 | } |
2182 | } |
2183 | // Leaf name: bitfield_extract_from_shr |
2184 | // Rule: bitfield_extract_from_shr |
2185 | if (!RuleConfig->isRuleDisabled(88)) { |
2186 | if (1 |
2187 | && [&]() { |
2188 | return Helper.matchBitfieldExtractFromShr(*MIs[0], MatchData88); |
2189 | return true; |
2190 | }() ) { |
2191 | LLVM_DEBUG(dbgs() << "Applying rule 'bitfield_extract_from_shr'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'bitfield_extract_from_shr'\n" ; } } while (false); |
2192 | Helper.applyBuildFn(*MIs[0], MatchData88); |
2193 | return true; |
2194 | } |
2195 | } |
2196 | // Leaf name: bitfield_extract_from_shr_and |
2197 | // Rule: bitfield_extract_from_shr_and |
2198 | if (!RuleConfig->isRuleDisabled(89)) { |
2199 | if (1 |
2200 | && [&]() { |
2201 | return Helper.matchBitfieldExtractFromShrAnd(*MIs[0], MatchData89); |
2202 | return true; |
2203 | }() ) { |
2204 | LLVM_DEBUG(dbgs() << "Applying rule 'bitfield_extract_from_shr_and'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'bitfield_extract_from_shr_and'\n" ; } } while (false); |
2205 | Helper.applyBuildFn(*MIs[0], MatchData89); |
2206 | return true; |
2207 | } |
2208 | } |
2209 | // Leaf name: fold_binop_into_select |
2210 | // Rule: fold_binop_into_select |
2211 | if (!RuleConfig->isRuleDisabled(105)) { |
2212 | if (1 |
2213 | && [&]() { |
2214 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2215 | return true; |
2216 | }() ) { |
2217 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
2218 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2219 | return true; |
2220 | } |
2221 | } |
2222 | return false; |
2223 | } |
2224 | if (Partition == 21 /* TargetOpcode::G_LSHR */) { |
2225 | // Leaf name: binop_right_undef_to_undef |
2226 | // Rule: binop_right_undef_to_undef |
2227 | if (!RuleConfig->isRuleDisabled(15)) { |
2228 | if (1 |
2229 | && [&]() { |
2230 | return Helper.matchOperandIsUndef(*MIs[0], 2); |
2231 | return true; |
2232 | }() ) { |
2233 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_right_undef_to_undef'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_right_undef_to_undef'\n" ; } } while (false); |
2234 | Helper.replaceInstWithUndef(*MIs[0]); |
2235 | return true; |
2236 | } |
2237 | } |
2238 | // Leaf name: right_identity_zero |
2239 | // Rule: right_identity_zero |
2240 | if (!RuleConfig->isRuleDisabled(24)) { |
2241 | if (1 |
2242 | && [&]() { |
2243 | return Helper.matchConstantOp(MIs[0]->getOperand(2), 0); |
2244 | return true; |
2245 | }() ) { |
2246 | LLVM_DEBUG(dbgs() << "Applying rule 'right_identity_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'right_identity_zero'\n" ; } } while (false); |
2247 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
2248 | return true; |
2249 | } |
2250 | } |
2251 | // Leaf name: shifts_too_big |
2252 | // Rule: shifts_too_big |
2253 | if (!RuleConfig->isRuleDisabled(41)) { |
2254 | if (1 |
2255 | && [&]() { |
2256 | return Helper.matchShiftsTooBig(*MIs[0]); |
2257 | return true; |
2258 | }() ) { |
2259 | LLVM_DEBUG(dbgs() << "Applying rule 'shifts_too_big'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shifts_too_big'\n" ; } } while (false); |
2260 | Helper.replaceInstWithUndef(*MIs[0]); |
2261 | return true; |
2262 | } |
2263 | } |
2264 | // Leaf name: shift_immed_chain |
2265 | // Rule: shift_immed_chain |
2266 | if (!RuleConfig->isRuleDisabled(79)) { |
2267 | if (1 |
2268 | && [&]() { |
2269 | return Helper.matchShiftImmedChain(*MIs[0], MatchData79); |
2270 | return true; |
2271 | }() ) { |
2272 | LLVM_DEBUG(dbgs() << "Applying rule 'shift_immed_chain'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shift_immed_chain'\n" ; } } while (false); |
2273 | Helper.applyShiftImmedChain(*MIs[0], MatchData79); |
2274 | return true; |
2275 | } |
2276 | } |
2277 | // Leaf name: shift_of_shifted_logic_chain |
2278 | // Rule: shift_of_shifted_logic_chain |
2279 | if (!RuleConfig->isRuleDisabled(80)) { |
2280 | if (1 |
2281 | && [&]() { |
2282 | return Helper.matchShiftOfShiftedLogic(*MIs[0], MatchData80); |
2283 | return true; |
2284 | }() ) { |
2285 | LLVM_DEBUG(dbgs() << "Applying rule 'shift_of_shifted_logic_chain'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shift_of_shifted_logic_chain'\n" ; } } while (false); |
2286 | Helper.applyShiftOfShiftedLogic(*MIs[0], MatchData80); |
2287 | return true; |
2288 | } |
2289 | } |
2290 | // Leaf name: bitfield_extract_from_shr |
2291 | // Rule: bitfield_extract_from_shr |
2292 | if (!RuleConfig->isRuleDisabled(88)) { |
2293 | if (1 |
2294 | && [&]() { |
2295 | return Helper.matchBitfieldExtractFromShr(*MIs[0], MatchData88); |
2296 | return true; |
2297 | }() ) { |
2298 | LLVM_DEBUG(dbgs() << "Applying rule 'bitfield_extract_from_shr'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'bitfield_extract_from_shr'\n" ; } } while (false); |
2299 | Helper.applyBuildFn(*MIs[0], MatchData88); |
2300 | return true; |
2301 | } |
2302 | } |
2303 | // Leaf name: bitfield_extract_from_shr_and |
2304 | // Rule: bitfield_extract_from_shr_and |
2305 | if (!RuleConfig->isRuleDisabled(89)) { |
2306 | if (1 |
2307 | && [&]() { |
2308 | return Helper.matchBitfieldExtractFromShrAnd(*MIs[0], MatchData89); |
2309 | return true; |
2310 | }() ) { |
2311 | LLVM_DEBUG(dbgs() << "Applying rule 'bitfield_extract_from_shr_and'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'bitfield_extract_from_shr_and'\n" ; } } while (false); |
2312 | Helper.applyBuildFn(*MIs[0], MatchData89); |
2313 | return true; |
2314 | } |
2315 | } |
2316 | // Leaf name: fold_binop_into_select |
2317 | // Rule: fold_binop_into_select |
2318 | if (!RuleConfig->isRuleDisabled(105)) { |
2319 | if (1 |
2320 | && [&]() { |
2321 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2322 | return true; |
2323 | }() ) { |
2324 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
2325 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2326 | return true; |
2327 | } |
2328 | } |
2329 | return false; |
2330 | } |
2331 | if (Partition == 22 /* TargetOpcode::G_ABS */) { |
2332 | // Leaf name: unary_undef_to_zero |
2333 | // Rule: unary_undef_to_zero |
2334 | if (!RuleConfig->isRuleDisabled(16)) { |
2335 | if (1 |
2336 | && [&]() { |
2337 | return Helper.matchOperandIsUndef(*MIs[0], 1); |
2338 | return true; |
2339 | }() ) { |
2340 | LLVM_DEBUG(dbgs() << "Applying rule 'unary_undef_to_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'unary_undef_to_zero'\n" ; } } while (false); |
2341 | Helper.replaceInstWithConstant(*MIs[0], 0); |
2342 | return true; |
2343 | } |
2344 | } |
2345 | return false; |
2346 | } |
2347 | if (Partition == 23 /* TargetOpcode::G_FPTOSI */) { |
2348 | // Leaf name: propagate_undef_any_op |
2349 | // Rule: propagate_undef_any_op |
2350 | if (!RuleConfig->isRuleDisabled(17)) { |
2351 | if (1 |
2352 | && [&]() { |
2353 | return Helper.matchAnyExplicitUseIsUndef(*MIs[0]); |
2354 | return true; |
2355 | }() ) { |
2356 | LLVM_DEBUG(dbgs() << "Applying rule 'propagate_undef_any_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'propagate_undef_any_op'\n" ; } } while (false); |
2357 | Helper.replaceInstWithUndef(*MIs[0]); |
2358 | return true; |
2359 | } |
2360 | } |
2361 | return false; |
2362 | } |
2363 | if (Partition == 24 /* TargetOpcode::G_FPTOUI */) { |
2364 | // Leaf name: propagate_undef_any_op |
2365 | // Rule: propagate_undef_any_op |
2366 | if (!RuleConfig->isRuleDisabled(17)) { |
2367 | if (1 |
2368 | && [&]() { |
2369 | return Helper.matchAnyExplicitUseIsUndef(*MIs[0]); |
2370 | return true; |
2371 | }() ) { |
2372 | LLVM_DEBUG(dbgs() << "Applying rule 'propagate_undef_any_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'propagate_undef_any_op'\n" ; } } while (false); |
2373 | Helper.replaceInstWithUndef(*MIs[0]); |
2374 | return true; |
2375 | } |
2376 | } |
2377 | return false; |
2378 | } |
2379 | if (Partition == 25 /* TargetOpcode::G_SUB */) { |
2380 | // Leaf name: propagate_undef_any_op |
2381 | // Rule: propagate_undef_any_op |
2382 | if (!RuleConfig->isRuleDisabled(17)) { |
2383 | if (1 |
2384 | && [&]() { |
2385 | return Helper.matchAnyExplicitUseIsUndef(*MIs[0]); |
2386 | return true; |
2387 | }() ) { |
2388 | LLVM_DEBUG(dbgs() << "Applying rule 'propagate_undef_any_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'propagate_undef_any_op'\n" ; } } while (false); |
2389 | Helper.replaceInstWithUndef(*MIs[0]); |
2390 | return true; |
2391 | } |
2392 | } |
2393 | // Leaf name: right_identity_zero |
2394 | // Rule: right_identity_zero |
2395 | if (!RuleConfig->isRuleDisabled(24)) { |
2396 | if (1 |
2397 | && [&]() { |
2398 | return Helper.matchConstantOp(MIs[0]->getOperand(2), 0); |
2399 | return true; |
2400 | }() ) { |
2401 | LLVM_DEBUG(dbgs() << "Applying rule 'right_identity_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'right_identity_zero'\n" ; } } while (false); |
2402 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
2403 | return true; |
2404 | } |
2405 | } |
2406 | // Leaf name: constant_fold |
2407 | // Rule: constant_fold |
2408 | if (!RuleConfig->isRuleDisabled(90)) { |
2409 | if (1 |
2410 | && [&]() { |
2411 | return Helper.matchConstantFold(*MIs[0], MatchData90); |
2412 | return true; |
2413 | }() ) { |
2414 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fold'\n" ; } } while (false); |
2415 | Helper.replaceInstWithConstant(*MIs[0], MatchData90); |
2416 | return true; |
2417 | } |
2418 | } |
2419 | // Leaf name: fold_binop_into_select |
2420 | // Rule: fold_binop_into_select |
2421 | if (!RuleConfig->isRuleDisabled(105)) { |
2422 | if (1 |
2423 | && [&]() { |
2424 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2425 | return true; |
2426 | }() ) { |
2427 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
2428 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2429 | return true; |
2430 | } |
2431 | } |
2432 | // Leaf name: sub_add_reg |
2433 | // Rule: sub_add_reg |
2434 | if (!RuleConfig->isRuleDisabled(106)) { |
2435 | if (1 |
2436 | && [&]() { |
2437 | return Helper.matchSubAddSameReg(*MIs[0], MatchData106); |
2438 | return true; |
2439 | }() ) { |
2440 | LLVM_DEBUG(dbgs() << "Applying rule 'sub_add_reg'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'sub_add_reg'\n" ; } } while (false); |
2441 | Helper.applyBuildFn(*MIs[0], MatchData106); |
2442 | return true; |
2443 | } |
2444 | } |
2445 | return false; |
2446 | } |
2447 | if (Partition == 26 /* TargetOpcode::G_XOR */) { |
2448 | // Leaf name: propagate_undef_any_op |
2449 | // Rule: propagate_undef_any_op |
2450 | if (!RuleConfig->isRuleDisabled(17)) { |
2451 | if (1 |
2452 | && [&]() { |
2453 | return Helper.matchAnyExplicitUseIsUndef(*MIs[0]); |
2454 | return true; |
2455 | }() ) { |
2456 | LLVM_DEBUG(dbgs() << "Applying rule 'propagate_undef_any_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'propagate_undef_any_op'\n" ; } } while (false); |
2457 | Helper.replaceInstWithUndef(*MIs[0]); |
2458 | return true; |
2459 | } |
2460 | } |
2461 | // Leaf name: right_identity_zero |
2462 | // Rule: right_identity_zero |
2463 | if (!RuleConfig->isRuleDisabled(24)) { |
2464 | if (1 |
2465 | && [&]() { |
2466 | return Helper.matchConstantOp(MIs[0]->getOperand(2), 0); |
2467 | return true; |
2468 | }() ) { |
2469 | LLVM_DEBUG(dbgs() << "Applying rule 'right_identity_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'right_identity_zero'\n" ; } } while (false); |
2470 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
2471 | return true; |
2472 | } |
2473 | } |
2474 | // Leaf name: hoist_logic_op_with_same_opcode_hands |
2475 | // Rule: hoist_logic_op_with_same_opcode_hands |
2476 | if (!RuleConfig->isRuleDisabled(40)) { |
2477 | if (1 |
2478 | && [&]() { |
2479 | return Helper.matchHoistLogicOpWithSameOpcodeHands(*MIs[0], MatchData40); |
2480 | return true; |
2481 | }() ) { |
2482 | LLVM_DEBUG(dbgs() << "Applying rule 'hoist_logic_op_with_same_opcode_hands'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'hoist_logic_op_with_same_opcode_hands'\n" ; } } while (false); |
2483 | Helper.applyBuildInstructionSteps(*MIs[0], MatchData40); |
2484 | return true; |
2485 | } |
2486 | } |
2487 | // Leaf name: not_cmp_fold |
2488 | // Rule: not_cmp_fold |
2489 | if (!RuleConfig->isRuleDisabled(60)) { |
2490 | if (1 |
2491 | && [&]() { |
2492 | return Helper.matchNotCmp(*MIs[0], MatchData60); |
2493 | return true; |
2494 | }() ) { |
2495 | LLVM_DEBUG(dbgs() << "Applying rule 'not_cmp_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'not_cmp_fold'\n" ; } } while (false); |
2496 | Helper.applyNotCmp(*MIs[0], MatchData60); |
2497 | return true; |
2498 | } |
2499 | } |
2500 | // Leaf name: xor_of_and_with_same_reg |
2501 | // Rule: xor_of_and_with_same_reg |
2502 | if (!RuleConfig->isRuleDisabled(77)) { |
2503 | if (1 |
2504 | && [&]() { |
2505 | return Helper.matchXorOfAndWithSameReg(*MIs[0], MatchData77); |
2506 | return true; |
2507 | }() ) { |
2508 | LLVM_DEBUG(dbgs() << "Applying rule 'xor_of_and_with_same_reg'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'xor_of_and_with_same_reg'\n" ; } } while (false); |
2509 | Helper.applyXorOfAndWithSameReg(*MIs[0], MatchData77); |
2510 | return true; |
2511 | } |
2512 | } |
2513 | // Leaf name: constant_fold |
2514 | // Rule: constant_fold |
2515 | if (!RuleConfig->isRuleDisabled(90)) { |
2516 | if (1 |
2517 | && [&]() { |
2518 | return Helper.matchConstantFold(*MIs[0], MatchData90); |
2519 | return true; |
2520 | }() ) { |
2521 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fold'\n" ; } } while (false); |
2522 | Helper.replaceInstWithConstant(*MIs[0], MatchData90); |
2523 | return true; |
2524 | } |
2525 | } |
2526 | // Leaf name: fold_binop_into_select |
2527 | // Rule: fold_binop_into_select |
2528 | if (!RuleConfig->isRuleDisabled(105)) { |
2529 | if (1 |
2530 | && [&]() { |
2531 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2532 | return true; |
2533 | }() ) { |
2534 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
2535 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2536 | return true; |
2537 | } |
2538 | } |
2539 | // Leaf name: commute_constant_to_rhs |
2540 | // Rule: commute_constant_to_rhs |
2541 | if (!RuleConfig->isRuleDisabled(110)) { |
2542 | if (1 |
2543 | && [&]() { |
2544 | |
2545 | return getIConstantVRegVal(MIs[0]->getOperand(1).getReg(), MRI).has_value(); |
2546 | |
2547 | return true; |
2548 | }() ) { |
2549 | LLVM_DEBUG(dbgs() << "Applying rule 'commute_constant_to_rhs'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'commute_constant_to_rhs'\n" ; } } while (false); |
2550 | |
2551 | Observer.changingInstr(*MIs[0]); |
2552 | Register LHSReg = MIs[0]->getOperand(1).getReg(); |
2553 | Register RHSReg = MIs[0]->getOperand(2).getReg(); |
2554 | MIs[0]->getOperand(1).setReg(RHSReg); |
2555 | MIs[0]->getOperand(2).setReg(LHSReg); |
2556 | Observer.changedInstr(*MIs[0]); |
2557 | |
2558 | return true; |
2559 | } |
2560 | } |
2561 | return false; |
2562 | } |
2563 | if (Partition == 27 /* TargetOpcode::G_TRUNC */) { |
2564 | // Leaf name: propagate_undef_any_op |
2565 | // Rule: propagate_undef_any_op |
2566 | if (!RuleConfig->isRuleDisabled(17)) { |
2567 | if (1 |
2568 | && [&]() { |
2569 | return Helper.matchAnyExplicitUseIsUndef(*MIs[0]); |
2570 | return true; |
2571 | }() ) { |
2572 | LLVM_DEBUG(dbgs() << "Applying rule 'propagate_undef_any_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'propagate_undef_any_op'\n" ; } } while (false); |
2573 | Helper.replaceInstWithUndef(*MIs[0]); |
2574 | return true; |
2575 | } |
2576 | } |
2577 | // Leaf name: trunc_buildvector_fold |
2578 | // Rule: trunc_buildvector_fold |
2579 | if (!RuleConfig->isRuleDisabled(35)) { |
2580 | if (1 |
2581 | && [&]() { |
2582 | return Helper.matchTruncBuildVectorFold(*MIs[0], MatchData35); |
2583 | return true; |
2584 | }() ) { |
2585 | LLVM_DEBUG(dbgs() << "Applying rule 'trunc_buildvector_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'trunc_buildvector_fold'\n" ; } } while (false); |
2586 | Helper.replaceSingleDefInstWithReg(*MIs[0], MatchData35); |
2587 | return true; |
2588 | } |
2589 | } |
2590 | // Leaf name: trunc_lshr_buildvector_fold |
2591 | // Rule: trunc_lshr_buildvector_fold |
2592 | if (!RuleConfig->isRuleDisabled(36)) { |
2593 | if (1 |
2594 | && [&]() { |
2595 | return Helper.matchTruncLshrBuildVectorFold(*MIs[0], MatchData36); |
2596 | return true; |
2597 | }() ) { |
2598 | LLVM_DEBUG(dbgs() << "Applying rule 'trunc_lshr_buildvector_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'trunc_lshr_buildvector_fold'\n" ; } } while (false); |
2599 | Helper.replaceSingleDefInstWithReg(*MIs[0], MatchData36); |
2600 | return true; |
2601 | } |
2602 | } |
2603 | // Leaf name: trunc_ext_fold |
2604 | // Rule: trunc_ext_fold |
2605 | if (!RuleConfig->isRuleDisabled(67)) { |
2606 | if (1 |
2607 | && [&]() { |
2608 | return Helper.matchCombineTruncOfExt(*MIs[0], MatchData67); |
2609 | return true; |
2610 | }() ) { |
2611 | LLVM_DEBUG(dbgs() << "Applying rule 'trunc_ext_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'trunc_ext_fold'\n" ; } } while (false); |
2612 | Helper.applyCombineTruncOfExt(*MIs[0], MatchData67); |
2613 | return true; |
2614 | } |
2615 | } |
2616 | // Leaf name: trunc_shift |
2617 | // Rule: trunc_shift |
2618 | if (!RuleConfig->isRuleDisabled(68)) { |
2619 | if (1 |
2620 | && [&]() { |
2621 | return Helper.matchCombineTruncOfShift(*MIs[0], MatchData68); |
2622 | return true; |
2623 | }() ) { |
2624 | LLVM_DEBUG(dbgs() << "Applying rule 'trunc_shift'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'trunc_shift'\n" ; } } while (false); |
2625 | Helper.applyCombineTruncOfShift(*MIs[0], MatchData68); |
2626 | return true; |
2627 | } |
2628 | } |
2629 | return false; |
2630 | } |
2631 | if (Partition == 28 /* TargetOpcode::G_SHUFFLE_VECTOR */) { |
2632 | // Leaf name: propagate_undef_all_ops |
2633 | // Rule: propagate_undef_all_ops |
2634 | if (!RuleConfig->isRuleDisabled(18)) { |
2635 | if (1 |
2636 | && [&]() { |
2637 | return Helper.matchAllExplicitUsesAreUndef(*MIs[0]); |
2638 | return true; |
2639 | }() ) { |
2640 | LLVM_DEBUG(dbgs() << "Applying rule 'propagate_undef_all_ops'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'propagate_undef_all_ops'\n" ; } } while (false); |
2641 | Helper.replaceInstWithUndef(*MIs[0]); |
2642 | return true; |
2643 | } |
2644 | } |
2645 | // Leaf name: propagate_undef_shuffle_mask |
2646 | // Rule: propagate_undef_shuffle_mask |
2647 | if (!RuleConfig->isRuleDisabled(19)) { |
2648 | if (1 |
2649 | && [&]() { |
2650 | return Helper.matchUndefShuffleVectorMask(*MIs[0]); |
2651 | return true; |
2652 | }() ) { |
2653 | LLVM_DEBUG(dbgs() << "Applying rule 'propagate_undef_shuffle_mask'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'propagate_undef_shuffle_mask'\n" ; } } while (false); |
2654 | Helper.replaceInstWithUndef(*MIs[0]); |
2655 | return true; |
2656 | } |
2657 | } |
2658 | return false; |
2659 | } |
2660 | if (Partition == 29 /* TargetOpcode::G_UNMERGE_VALUES */) { |
2661 | // Leaf name: unmerge_undef |
2662 | // Rule: unmerge_undef |
2663 | if (!RuleConfig->isRuleDisabled(21)) { |
2664 | if (1 |
2665 | && [&]() { |
2666 | return Helper.matchCombineUnmergeUndef(*MIs[0], MatchData21); |
2667 | return true; |
2668 | }() ) { |
2669 | LLVM_DEBUG(dbgs() << "Applying rule 'unmerge_undef'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'unmerge_undef'\n" ; } } while (false); |
2670 | Helper.applyBuildFn(*MIs[0], MatchData21); |
2671 | return true; |
2672 | } |
2673 | } |
2674 | // Leaf name: unmerge_merge |
2675 | // Rule: unmerge_merge |
2676 | if (!RuleConfig->isRuleDisabled(62)) { |
2677 | if (1 |
2678 | && [&]() { |
2679 | return Helper.matchCombineUnmergeMergeToPlainValues(*MIs[0], MatchData62); |
2680 | return true; |
2681 | }() ) { |
2682 | LLVM_DEBUG(dbgs() << "Applying rule 'unmerge_merge'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'unmerge_merge'\n" ; } } while (false); |
2683 | Helper.applyCombineUnmergeMergeToPlainValues(*MIs[0], MatchData62); |
2684 | return true; |
2685 | } |
2686 | } |
2687 | // Leaf name: unmerge_cst |
2688 | // Rule: unmerge_cst |
2689 | if (!RuleConfig->isRuleDisabled(63)) { |
2690 | if (1 |
2691 | && [&]() { |
2692 | return Helper.matchCombineUnmergeConstant(*MIs[0], MatchData63); |
2693 | return true; |
2694 | }() ) { |
2695 | LLVM_DEBUG(dbgs() << "Applying rule 'unmerge_cst'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'unmerge_cst'\n" ; } } while (false); |
2696 | Helper.applyCombineUnmergeConstant(*MIs[0], MatchData63); |
2697 | return true; |
2698 | } |
2699 | } |
2700 | // Leaf name: unmerge_dead_to_trunc |
2701 | // Rule: unmerge_dead_to_trunc |
2702 | if (!RuleConfig->isRuleDisabled(64)) { |
2703 | if (1 |
2704 | && [&]() { |
2705 | return Helper.matchCombineUnmergeWithDeadLanesToTrunc(*MIs[0]); |
2706 | return true; |
2707 | }() ) { |
2708 | LLVM_DEBUG(dbgs() << "Applying rule 'unmerge_dead_to_trunc'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'unmerge_dead_to_trunc'\n" ; } } while (false); |
2709 | Helper.applyCombineUnmergeWithDeadLanesToTrunc(*MIs[0]); |
2710 | return true; |
2711 | } |
2712 | } |
2713 | // Leaf name: unmerge_zext_to_zext |
2714 | // Rule: unmerge_zext_to_zext |
2715 | if (!RuleConfig->isRuleDisabled(65)) { |
2716 | if (1 |
2717 | && [&]() { |
2718 | return Helper.matchCombineUnmergeZExtToZExt(*MIs[0]); |
2719 | return true; |
2720 | }() ) { |
2721 | LLVM_DEBUG(dbgs() << "Applying rule 'unmerge_zext_to_zext'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'unmerge_zext_to_zext'\n" ; } } while (false); |
2722 | Helper.applyCombineUnmergeZExtToZExt(*MIs[0]); |
2723 | return true; |
2724 | } |
2725 | } |
2726 | return false; |
2727 | } |
2728 | if (Partition == 30 /* TargetOpcode::G_SELECT */) { |
2729 | // Leaf name: select_same_val |
2730 | // Rule: select_same_val |
2731 | if (!RuleConfig->isRuleDisabled(23)) { |
2732 | if (1 |
2733 | && [&]() { |
2734 | return Helper.matchSelectSameVal(*MIs[0]); |
2735 | return true; |
2736 | }() ) { |
2737 | LLVM_DEBUG(dbgs() << "Applying rule 'select_same_val'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'select_same_val'\n" ; } } while (false); |
2738 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 2); |
2739 | return true; |
2740 | } |
2741 | } |
2742 | // Leaf name: select_undef_cmp |
2743 | // Rule: select_undef_cmp |
2744 | if (!RuleConfig->isRuleDisabled(48)) { |
2745 | if (1 |
2746 | && [&]() { |
2747 | return Helper.matchUndefSelectCmp(*MIs[0]); |
2748 | return true; |
2749 | }() ) { |
2750 | LLVM_DEBUG(dbgs() << "Applying rule 'select_undef_cmp'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'select_undef_cmp'\n" ; } } while (false); |
2751 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 2); |
2752 | return true; |
2753 | } |
2754 | } |
2755 | // Leaf name: select_constant_cmp |
2756 | // Rule: select_constant_cmp |
2757 | if (!RuleConfig->isRuleDisabled(49)) { |
2758 | if (1 |
2759 | && [&]() { |
2760 | return Helper.matchConstantSelectCmp(*MIs[0], MatchData49); |
2761 | return true; |
2762 | }() ) { |
2763 | LLVM_DEBUG(dbgs() << "Applying rule 'select_constant_cmp'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'select_constant_cmp'\n" ; } } while (false); |
2764 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], MatchData49); |
2765 | return true; |
2766 | } |
2767 | } |
2768 | // Leaf name: select_to_logical |
2769 | // Rule: select_to_logical |
2770 | if (!RuleConfig->isRuleDisabled(50)) { |
2771 | if (1 |
2772 | && [&]() { |
2773 | return Helper.matchSelectToLogical(*MIs[0], MatchData50); |
2774 | return true; |
2775 | }() ) { |
2776 | LLVM_DEBUG(dbgs() << "Applying rule 'select_to_logical'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'select_to_logical'\n" ; } } while (false); |
2777 | Helper.applyBuildFn(*MIs[0], MatchData50); |
2778 | return true; |
2779 | } |
2780 | } |
2781 | // Leaf name: select_to_minmax |
2782 | // Rule: select_to_minmax |
2783 | if (!RuleConfig->isRuleDisabled(107)) { |
2784 | if (1 |
2785 | && [&]() { |
2786 | return Helper.matchSimplifySelectToMinMax(*MIs[0], MatchData107); |
2787 | return true; |
2788 | }() ) { |
2789 | LLVM_DEBUG(dbgs() << "Applying rule 'select_to_minmax'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'select_to_minmax'\n" ; } } while (false); |
2790 | Helper.applyBuildFn(*MIs[0], MatchData107); |
2791 | return true; |
2792 | } |
2793 | } |
2794 | return false; |
2795 | } |
2796 | if (Partition == 31 /* TargetOpcode::G_PTR_ADD */) { |
2797 | // Leaf name: right_identity_zero |
2798 | // Rule: right_identity_zero |
2799 | if (!RuleConfig->isRuleDisabled(24)) { |
2800 | if (1 |
2801 | && [&]() { |
2802 | return Helper.matchConstantOp(MIs[0]->getOperand(2), 0); |
2803 | return true; |
2804 | }() ) { |
2805 | LLVM_DEBUG(dbgs() << "Applying rule 'right_identity_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'right_identity_zero'\n" ; } } while (false); |
2806 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
2807 | return true; |
2808 | } |
2809 | } |
2810 | // Leaf name: reassoc_ptradd |
2811 | // Rule: reassoc_ptradd |
2812 | if (!RuleConfig->isRuleDisabled(42)) { |
2813 | if (1 |
2814 | && [&]() { |
2815 | return Helper.matchReassocPtrAdd(*MIs[0], MatchData42); |
2816 | return true; |
2817 | }() ) { |
2818 | LLVM_DEBUG(dbgs() << "Applying rule 'reassoc_ptradd'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'reassoc_ptradd'\n" ; } } while (false); |
2819 | Helper.applyBuildFnNoErase(*MIs[0], MatchData42); |
2820 | return true; |
2821 | } |
2822 | } |
2823 | // Leaf name: ptr_add_immed_chain |
2824 | // Rule: ptr_add_immed_chain |
2825 | if (!RuleConfig->isRuleDisabled(43)) { |
2826 | if (1 |
2827 | && [&]() { |
2828 | return Helper.matchPtrAddImmedChain(*MIs[0], MatchData43); |
2829 | return true; |
2830 | }() ) { |
2831 | LLVM_DEBUG(dbgs() << "Applying rule 'ptr_add_immed_chain'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'ptr_add_immed_chain'\n" ; } } while (false); |
2832 | Helper.applyPtrAddImmedChain(*MIs[0], MatchData43); |
2833 | return true; |
2834 | } |
2835 | } |
2836 | // Leaf name: const_ptradd_to_i2p |
2837 | // Rule: const_ptradd_to_i2p |
2838 | if (!RuleConfig->isRuleDisabled(70)) { |
2839 | if (1 |
2840 | && [&]() { |
2841 | return Helper.matchCombineConstPtrAddToI2P(*MIs[0], MatchData70); |
2842 | return true; |
2843 | }() ) { |
2844 | LLVM_DEBUG(dbgs() << "Applying rule 'const_ptradd_to_i2p'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'const_ptradd_to_i2p'\n" ; } } while (false); |
2845 | Helper.applyCombineConstPtrAddToI2P(*MIs[0], MatchData70); |
2846 | return true; |
2847 | } |
2848 | } |
2849 | // Leaf name: ptr_add_with_zero |
2850 | // Rule: ptr_add_with_zero |
2851 | if (!RuleConfig->isRuleDisabled(78)) { |
2852 | if (1 |
2853 | && [&]() { |
2854 | return Helper.matchPtrAddZero(*MIs[0]); |
2855 | return true; |
2856 | }() ) { |
2857 | LLVM_DEBUG(dbgs() << "Applying rule 'ptr_add_with_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'ptr_add_with_zero'\n" ; } } while (false); |
2858 | Helper.applyPtrAddZero(*MIs[0]); |
2859 | return true; |
2860 | } |
2861 | } |
2862 | // Leaf name: fold_binop_into_select |
2863 | // Rule: fold_binop_into_select |
2864 | if (!RuleConfig->isRuleDisabled(105)) { |
2865 | if (1 |
2866 | && [&]() { |
2867 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2868 | return true; |
2869 | }() ) { |
2870 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
2871 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2872 | return true; |
2873 | } |
2874 | } |
2875 | return false; |
2876 | } |
2877 | if (Partition == 32 /* TargetOpcode::G_ROTL */) { |
2878 | // Leaf name: right_identity_zero |
2879 | // Rule: right_identity_zero |
2880 | if (!RuleConfig->isRuleDisabled(24)) { |
2881 | if (1 |
2882 | && [&]() { |
2883 | return Helper.matchConstantOp(MIs[0]->getOperand(2), 0); |
2884 | return true; |
2885 | }() ) { |
2886 | LLVM_DEBUG(dbgs() << "Applying rule 'right_identity_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'right_identity_zero'\n" ; } } while (false); |
2887 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
2888 | return true; |
2889 | } |
2890 | } |
2891 | return false; |
2892 | } |
2893 | if (Partition == 33 /* TargetOpcode::G_ROTR */) { |
2894 | // Leaf name: right_identity_zero |
2895 | // Rule: right_identity_zero |
2896 | if (!RuleConfig->isRuleDisabled(24)) { |
2897 | if (1 |
2898 | && [&]() { |
2899 | return Helper.matchConstantOp(MIs[0]->getOperand(2), 0); |
2900 | return true; |
2901 | }() ) { |
2902 | LLVM_DEBUG(dbgs() << "Applying rule 'right_identity_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'right_identity_zero'\n" ; } } while (false); |
2903 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
2904 | return true; |
2905 | } |
2906 | } |
2907 | return false; |
2908 | } |
2909 | if (Partition == 34 /* TargetOpcode::G_SDIV */) { |
2910 | // Leaf name: binop_left_to_zero |
2911 | // Rule: binop_left_to_zero |
2912 | if (!RuleConfig->isRuleDisabled(26)) { |
2913 | if (1 |
2914 | && [&]() { |
2915 | return Helper.matchOperandIsZero(*MIs[0], 1); |
2916 | return true; |
2917 | }() ) { |
2918 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_left_to_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_left_to_zero'\n" ; } } while (false); |
2919 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
2920 | return true; |
2921 | } |
2922 | } |
2923 | // Leaf name: div_rem_to_divrem |
2924 | // Rule: div_rem_to_divrem |
2925 | if (!RuleConfig->isRuleDisabled(83)) { |
2926 | if (1 |
2927 | && [&]() { |
2928 | return Helper.matchCombineDivRem(*MIs[0], MatchData83); |
2929 | return true; |
2930 | }() ) { |
2931 | LLVM_DEBUG(dbgs() << "Applying rule 'div_rem_to_divrem'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'div_rem_to_divrem'\n" ; } } while (false); |
2932 | Helper.applyCombineDivRem(*MIs[0], MatchData83); |
2933 | return true; |
2934 | } |
2935 | } |
2936 | // Leaf name: sdiv_by_const |
2937 | // Rule: sdiv_by_const |
2938 | if (!RuleConfig->isRuleDisabled(93)) { |
2939 | if (1 |
2940 | && [&]() { |
2941 | return Helper.matchSDivByConst(*MIs[0]); |
2942 | return true; |
2943 | }() ) { |
2944 | LLVM_DEBUG(dbgs() << "Applying rule 'sdiv_by_const'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'sdiv_by_const'\n" ; } } while (false); |
2945 | Helper.applySDivByConst(*MIs[0]); |
2946 | return true; |
2947 | } |
2948 | } |
2949 | // Leaf name: fold_binop_into_select |
2950 | // Rule: fold_binop_into_select |
2951 | if (!RuleConfig->isRuleDisabled(105)) { |
2952 | if (1 |
2953 | && [&]() { |
2954 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2955 | return true; |
2956 | }() ) { |
2957 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
2958 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2959 | return true; |
2960 | } |
2961 | } |
2962 | return false; |
2963 | } |
2964 | if (Partition == 35 /* TargetOpcode::G_SREM */) { |
2965 | // Leaf name: binop_left_to_zero |
2966 | // Rule: binop_left_to_zero |
2967 | if (!RuleConfig->isRuleDisabled(26)) { |
2968 | if (1 |
2969 | && [&]() { |
2970 | return Helper.matchOperandIsZero(*MIs[0], 1); |
2971 | return true; |
2972 | }() ) { |
2973 | LLVM_DEBUG(dbgs() << "Applying rule 'binop_left_to_zero'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'binop_left_to_zero'\n" ; } } while (false); |
2974 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
2975 | return true; |
2976 | } |
2977 | } |
2978 | // Leaf name: div_rem_to_divrem |
2979 | // Rule: div_rem_to_divrem |
2980 | if (!RuleConfig->isRuleDisabled(83)) { |
2981 | if (1 |
2982 | && [&]() { |
2983 | return Helper.matchCombineDivRem(*MIs[0], MatchData83); |
2984 | return true; |
2985 | }() ) { |
2986 | LLVM_DEBUG(dbgs() << "Applying rule 'div_rem_to_divrem'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'div_rem_to_divrem'\n" ; } } while (false); |
2987 | Helper.applyCombineDivRem(*MIs[0], MatchData83); |
2988 | return true; |
2989 | } |
2990 | } |
2991 | // Leaf name: fold_binop_into_select |
2992 | // Rule: fold_binop_into_select |
2993 | if (!RuleConfig->isRuleDisabled(105)) { |
2994 | if (1 |
2995 | && [&]() { |
2996 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
2997 | return true; |
2998 | }() ) { |
2999 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
3000 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
3001 | return true; |
3002 | } |
3003 | } |
3004 | return false; |
3005 | } |
3006 | if (Partition == 36 /* TargetOpcode::G_INTTOPTR */) { |
3007 | // Leaf name: p2i_to_i2p |
3008 | // Rule: p2i_to_i2p |
3009 | if (!RuleConfig->isRuleDisabled(28)) { |
3010 | if (1 |
3011 | && [&]() { |
3012 | return Helper.matchCombineI2PToP2I(*MIs[0], MatchData28); |
3013 | return true; |
3014 | }() ) { |
3015 | LLVM_DEBUG(dbgs() << "Applying rule 'p2i_to_i2p'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'p2i_to_i2p'\n" ; } } while (false); |
3016 | Helper.applyCombineI2PToP2I(*MIs[0], MatchData28); |
3017 | return true; |
3018 | } |
3019 | } |
3020 | return false; |
3021 | } |
3022 | if (Partition == 37 /* TargetOpcode::G_PTRTOINT */) { |
3023 | Partition = -1; |
3024 | if (MIs.size() <= 1) MIs.resize(2); |
3025 | MIs[1] = nullptr; |
3026 | if (MIs[0]->getOperand(1).isReg()) |
3027 | MIs[1] = MRI.getVRegDef(MIs[0]->getOperand(1).getReg()); |
3028 | if (MIs[1] != nullptr) Partition = 0; |
3029 | if (Partition == -1) return false; |
3030 | if (Partition == 0 /* true */) { |
3031 | Partition = -1; |
3032 | switch (MIs[1]->getOpcode()) { |
3033 | case TargetOpcode::G_INTTOPTR: Partition = 0; break; |
3034 | } |
3035 | // Default case but without conflicting with potential default case in selection. |
3036 | if (Partition == -1) return false; |
3037 | if (Partition == 0 /* TargetOpcode::G_INTTOPTR */) { |
3038 | // Leaf name: i2p_to_p2i |
3039 | // Rule: i2p_to_p2i |
3040 | if (!RuleConfig->isRuleDisabled(29)) { |
3041 | if (1 |
3042 | && [&]() { |
3043 | MatchData29 = MIs[1]->getOperand(1).getReg(); |
3044 | return true; |
3045 | }() ) { |
3046 | LLVM_DEBUG(dbgs() << "Applying rule 'i2p_to_p2i'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'i2p_to_p2i'\n" ; } } while (false); |
3047 | Helper.applyCombineP2IToI2P(*MIs[0], MatchData29); |
3048 | return true; |
3049 | } |
3050 | } |
3051 | return false; |
3052 | } |
3053 | } |
3054 | } |
3055 | if (Partition == 38 /* TargetOpcode::G_ANYEXT */) { |
3056 | // Leaf name: anyext_trunc_fold |
3057 | // Rule: anyext_trunc_fold |
3058 | if (!RuleConfig->isRuleDisabled(30)) { |
3059 | if (1 |
3060 | && [&]() { |
3061 | return Helper.matchCombineAnyExtTrunc(*MIs[0], MatchData30); |
3062 | return true; |
3063 | }() ) { |
3064 | LLVM_DEBUG(dbgs() << "Applying rule 'anyext_trunc_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'anyext_trunc_fold'\n" ; } } while (false); |
3065 | return Helper.replaceSingleDefInstWithReg(*MIs[0], MatchData30); |
3066 | return true; |
3067 | } |
3068 | } |
3069 | // Leaf name: ext_ext_fold |
3070 | // Rule: ext_ext_fold |
3071 | if (!RuleConfig->isRuleDisabled(59)) { |
3072 | if (1 |
3073 | && [&]() { |
3074 | return Helper.matchCombineExtOfExt(*MIs[0], MatchData59); |
3075 | return true; |
3076 | }() ) { |
3077 | LLVM_DEBUG(dbgs() << "Applying rule 'ext_ext_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'ext_ext_fold'\n" ; } } while (false); |
3078 | Helper.applyCombineExtOfExt(*MIs[0], MatchData59); |
3079 | return true; |
3080 | } |
3081 | } |
3082 | return false; |
3083 | } |
3084 | if (Partition == 39 /* TargetOpcode::G_FNEG */) { |
3085 | Partition = -1; |
3086 | if (MIs.size() <= 1) MIs.resize(2); |
3087 | MIs[1] = nullptr; |
3088 | if (MIs[0]->getOperand(1).isReg()) |
3089 | MIs[1] = MRI.getVRegDef(MIs[0]->getOperand(1).getReg()); |
3090 | if (MIs[1] == nullptr) Partition = 1; |
3091 | if (MIs[1] != nullptr) Partition = 0; |
3092 | if (Partition == -1) return false; |
3093 | if (Partition == 0 /* true */) { |
3094 | Partition = -1; |
Value stored to 'Partition' is never read | |
3095 | switch (MIs[1]->getOpcode()) { |
3096 | case TargetOpcode::G_FNEG: Partition = 0; break; |
3097 | default: Partition = 1; break; |
3098 | } |
3099 | // Default case but without conflicting with potential default case in selection. |
3100 | if (Partition == -1) return false; |
3101 | if (Partition == 0 /* TargetOpcode::G_FNEG */) { |
3102 | // Leaf name: fneg_fneg_fold |
3103 | // Rule: fneg_fneg_fold |
3104 | if (!RuleConfig->isRuleDisabled(31)) { |
3105 | if (1 |
3106 | && [&]() { |
3107 | MatchData31 = MIs[1]->getOperand(1).getReg(); |
3108 | return true; |
3109 | }() ) { |
3110 | LLVM_DEBUG(dbgs() << "Applying rule 'fneg_fneg_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fneg_fneg_fold'\n" ; } } while (false); |
3111 | return Helper.replaceSingleDefInstWithReg(*MIs[0], MatchData31); |
3112 | return true; |
3113 | } |
3114 | } |
3115 | // Leaf name: constant_fp_op |
3116 | // Rule: constant_fp_op |
3117 | if (!RuleConfig->isRuleDisabled(69)) { |
3118 | if (1 |
3119 | && [&]() { |
3120 | return Helper.matchCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3121 | return true; |
3122 | }() ) { |
3123 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fp_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fp_op'\n" ; } } while (false); |
3124 | Helper.applyCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3125 | return true; |
3126 | } |
3127 | } |
3128 | return false; |
3129 | } |
3130 | if (Partition == 1 /* * or nullptr */) { |
3131 | // Leaf name: constant_fp_op |
3132 | // Rule: constant_fp_op |
3133 | if (!RuleConfig->isRuleDisabled(69)) { |
3134 | if (1 |
3135 | && [&]() { |
3136 | return Helper.matchCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3137 | return true; |
3138 | }() ) { |
3139 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fp_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fp_op'\n" ; } } while (false); |
3140 | Helper.applyCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3141 | return true; |
3142 | } |
3143 | } |
3144 | return false; |
3145 | } |
3146 | } |
3147 | if (Partition == 1 /* false */) { |
3148 | // Leaf name: constant_fp_op |
3149 | // Rule: constant_fp_op |
3150 | if (!RuleConfig->isRuleDisabled(69)) { |
3151 | if (1 |
3152 | && [&]() { |
3153 | return Helper.matchCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3154 | return true; |
3155 | }() ) { |
3156 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fp_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fp_op'\n" ; } } while (false); |
3157 | Helper.applyCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3158 | return true; |
3159 | } |
3160 | } |
3161 | return false; |
3162 | } |
3163 | } |
3164 | if (Partition == 40 /* TargetOpcode::G_BUILD_VECTOR_TRUNC */) { |
3165 | // Leaf name: buildvector_identity_fold |
3166 | // Rule: buildvector_identity_fold |
3167 | if (!RuleConfig->isRuleDisabled(34)) { |
3168 | if (1 |
3169 | && [&]() { |
3170 | return Helper.matchBuildVectorIdentityFold(*MIs[0], MatchData34); |
3171 | return true; |
3172 | }() ) { |
3173 | LLVM_DEBUG(dbgs() << "Applying rule 'buildvector_identity_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'buildvector_identity_fold'\n" ; } } while (false); |
3174 | Helper.replaceSingleDefInstWithReg(*MIs[0], MatchData34); |
3175 | return true; |
3176 | } |
3177 | } |
3178 | return false; |
3179 | } |
3180 | if (Partition == 41 /* TargetOpcode::G_BITCAST */) { |
3181 | Partition = -1; |
3182 | if (MIs.size() <= 1) MIs.resize(2); |
3183 | MIs[1] = nullptr; |
3184 | if (MIs[0]->getOperand(1).isReg()) |
3185 | MIs[1] = MRI.getVRegDef(MIs[0]->getOperand(1).getReg()); |
3186 | if (MIs[1] != nullptr) Partition = 0; |
3187 | if (Partition == -1) return false; |
3188 | if (Partition == 0 /* true */) { |
3189 | Partition = -1; |
3190 | switch (MIs[1]->getOpcode()) { |
3191 | case TargetOpcode::G_BITCAST: Partition = 0; break; |
3192 | } |
3193 | // Default case but without conflicting with potential default case in selection. |
3194 | if (Partition == -1) return false; |
3195 | if (Partition == 0 /* TargetOpcode::G_BITCAST */) { |
3196 | // Leaf name: bitcast_bitcast_fold |
3197 | // Rule: bitcast_bitcast_fold |
3198 | if (!RuleConfig->isRuleDisabled(37)) { |
3199 | if (1 |
3200 | && [&]() { |
3201 | return MRI.getType(MIs[1]->getOperand(1).getReg()) == MRI.getType(MIs[0]->getOperand(0).getReg()); |
3202 | return true; |
3203 | }() ) { |
3204 | LLVM_DEBUG(dbgs() << "Applying rule 'bitcast_bitcast_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'bitcast_bitcast_fold'\n" ; } } while (false); |
3205 | Helper.replaceSingleDefInstWithReg(*MIs[0], MIs[1]->getOperand(1).getReg()); |
3206 | return true; |
3207 | } |
3208 | } |
3209 | return false; |
3210 | } |
3211 | } |
3212 | } |
3213 | if (Partition == 42 /* TargetOpcode::G_PHI */) { |
3214 | // Leaf name: extend_through_phis |
3215 | // Rule: extend_through_phis |
3216 | if (!RuleConfig->isRuleDisabled(38)) { |
3217 | if (1 |
3218 | && [&]() { |
3219 | return Helper.matchExtendThroughPhis(*MIs[0], MatchData38); |
3220 | return true; |
3221 | }() ) { |
3222 | LLVM_DEBUG(dbgs() << "Applying rule 'extend_through_phis'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'extend_through_phis'\n" ; } } while (false); |
3223 | Helper.applyExtendThroughPhis(*MIs[0], MatchData38); |
3224 | return true; |
3225 | } |
3226 | } |
3227 | return false; |
3228 | } |
3229 | if (Partition == 43 /* TargetOpcode::G_SEXT_INREG */) { |
3230 | // Leaf name: sext_inreg_of_load |
3231 | // Rule: sext_inreg_of_load |
3232 | if (!RuleConfig->isRuleDisabled(45)) { |
3233 | if (1 |
3234 | && [&]() { |
3235 | return Helper.matchSextInRegOfLoad(*MIs[0], MatchData45); |
3236 | return true; |
3237 | }() ) { |
3238 | LLVM_DEBUG(dbgs() << "Applying rule 'sext_inreg_of_load'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'sext_inreg_of_load'\n" ; } } while (false); |
3239 | Helper.applySextInRegOfLoad(*MIs[0], MatchData45); |
3240 | return true; |
3241 | } |
3242 | } |
3243 | // Leaf name: redundant_sext_inreg |
3244 | // Rule: redundant_sext_inreg |
3245 | if (!RuleConfig->isRuleDisabled(52)) { |
3246 | if (1 |
3247 | && [&]() { |
3248 | return Helper.matchRedundantSExtInReg(*MIs[0]); |
3249 | return true; |
3250 | }() ) { |
3251 | LLVM_DEBUG(dbgs() << "Applying rule 'redundant_sext_inreg'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'redundant_sext_inreg'\n" ; } } while (false); |
3252 | return Helper.replaceSingleDefInstWithOperand(*MIs[0], 1); |
3253 | return true; |
3254 | } |
3255 | } |
3256 | // Leaf name: sext_inreg_to_zext_inreg |
3257 | // Rule: sext_inreg_to_zext_inreg |
3258 | if (!RuleConfig->isRuleDisabled(58)) { |
3259 | if (1 |
3260 | && [&]() { |
3261 | |
3262 | unsigned BitWidth = MRI.getType(MIs[0]->getOperand(1).getReg()).getScalarSizeInBits(); |
3263 | return Helper.getKnownBits()->maskedValueIsZero(MIs[0]->getOperand(1).getReg(), |
3264 | APInt::getOneBitSet(BitWidth, MIs[0]->getOperand(2).getImm() - 1)); |
3265 | return true; |
3266 | }() ) { |
3267 | LLVM_DEBUG(dbgs() << "Applying rule 'sext_inreg_to_zext_inreg'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'sext_inreg_to_zext_inreg'\n" ; } } while (false); |
3268 | |
3269 | Helper.getBuilder().setInstrAndDebugLoc(*MIs[0]); |
3270 | Helper.getBuilder().buildZExtInReg(MIs[0]->getOperand(0), MIs[0]->getOperand(1), MIs[0]->getOperand(2).getImm()); |
3271 | MIs[0]->eraseFromParent(); |
3272 | return true; |
3273 | |
3274 | return true; |
3275 | } |
3276 | } |
3277 | // Leaf name: bitfield_extract_from_sext_inreg |
3278 | // Rule: bitfield_extract_from_sext_inreg |
3279 | if (!RuleConfig->isRuleDisabled(86)) { |
3280 | if (1 |
3281 | && [&]() { |
3282 | return Helper.matchBitfieldExtractFromSExtInReg(*MIs[0], MatchData86); |
3283 | return true; |
3284 | }() ) { |
3285 | LLVM_DEBUG(dbgs() << "Applying rule 'bitfield_extract_from_sext_inreg'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'bitfield_extract_from_sext_inreg'\n" ; } } while (false); |
3286 | Helper.applyBuildFn(*MIs[0], MatchData86); |
3287 | return true; |
3288 | } |
3289 | } |
3290 | return false; |
3291 | } |
3292 | if (Partition == 44 /* TargetOpcode::G_ZEXT */) { |
3293 | // Leaf name: zext_trunc_fold |
3294 | // Rule: zext_trunc_fold |
3295 | if (!RuleConfig->isRuleDisabled(55)) { |
3296 | if (1 |
3297 | && [&]() { |
3298 | return Helper.matchCombineZextTrunc(*MIs[0], MatchData55); |
3299 | return true; |
3300 | }() ) { |
3301 | LLVM_DEBUG(dbgs() << "Applying rule 'zext_trunc_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'zext_trunc_fold'\n" ; } } while (false); |
3302 | return Helper.replaceSingleDefInstWithReg(*MIs[0], MatchData55); |
3303 | return true; |
3304 | } |
3305 | } |
3306 | // Leaf name: ext_ext_fold |
3307 | // Rule: ext_ext_fold |
3308 | if (!RuleConfig->isRuleDisabled(59)) { |
3309 | if (1 |
3310 | && [&]() { |
3311 | return Helper.matchCombineExtOfExt(*MIs[0], MatchData59); |
3312 | return true; |
3313 | }() ) { |
3314 | LLVM_DEBUG(dbgs() << "Applying rule 'ext_ext_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'ext_ext_fold'\n" ; } } while (false); |
3315 | Helper.applyCombineExtOfExt(*MIs[0], MatchData59); |
3316 | return true; |
3317 | } |
3318 | } |
3319 | return false; |
3320 | } |
3321 | if (Partition == 45 /* TargetOpcode::G_ICMP */) { |
3322 | // Leaf name: icmp_to_true_false_known_bits |
3323 | // Rule: icmp_to_true_false_known_bits |
3324 | if (!RuleConfig->isRuleDisabled(56)) { |
3325 | if (1 |
3326 | && [&]() { |
3327 | return Helper.matchICmpToTrueFalseKnownBits(*MIs[0], MatchData56); |
3328 | return true; |
3329 | }() ) { |
3330 | LLVM_DEBUG(dbgs() << "Applying rule 'icmp_to_true_false_known_bits'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'icmp_to_true_false_known_bits'\n" ; } } while (false); |
3331 | Helper.replaceInstWithConstant(*MIs[0], MatchData56); |
3332 | return true; |
3333 | } |
3334 | } |
3335 | // Leaf name: icmp_to_lhs_known_bits |
3336 | // Rule: icmp_to_lhs_known_bits |
3337 | if (!RuleConfig->isRuleDisabled(57)) { |
3338 | if (1 |
3339 | && [&]() { |
3340 | return Helper.matchICmpToLHSKnownBits(*MIs[0], MatchData57); |
3341 | return true; |
3342 | }() ) { |
3343 | LLVM_DEBUG(dbgs() << "Applying rule 'icmp_to_lhs_known_bits'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'icmp_to_lhs_known_bits'\n" ; } } while (false); |
3344 | Helper.applyBuildFn(*MIs[0], MatchData57); |
3345 | return true; |
3346 | } |
3347 | } |
3348 | // Leaf name: redundant_binop_in_equality |
3349 | // Rule: redundant_binop_in_equality |
3350 | if (!RuleConfig->isRuleDisabled(108)) { |
3351 | if (1 |
3352 | && [&]() { |
3353 | return Helper.matchRedundantBinOpInEquality(*MIs[0], MatchData108); |
3354 | return true; |
3355 | }() ) { |
3356 | LLVM_DEBUG(dbgs() << "Applying rule 'redundant_binop_in_equality'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'redundant_binop_in_equality'\n" ; } } while (false); |
3357 | Helper.applyBuildFn(*MIs[0], MatchData108); |
3358 | return true; |
3359 | } |
3360 | } |
3361 | // Leaf name: icmp_redundant_trunc |
3362 | // Rule: icmp_redundant_trunc |
3363 | if (!RuleConfig->isRuleDisabled(112)) { |
3364 | if (1 |
3365 | && [&]() { |
3366 | return matchICmpRedundantTrunc(*MIs[0], MRI, Helper.getKnownBits(), MatchData112); |
3367 | return true; |
3368 | }() ) { |
3369 | LLVM_DEBUG(dbgs() << "Applying rule 'icmp_redundant_trunc'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'icmp_redundant_trunc'\n" ; } } while (false); |
3370 | applyICmpRedundantTrunc(*MIs[0], MRI, B, Observer, MatchData112); |
3371 | return true; |
3372 | } |
3373 | } |
3374 | return false; |
3375 | } |
3376 | if (Partition == 46 /* TargetOpcode::G_SEXT */) { |
3377 | // Leaf name: ext_ext_fold |
3378 | // Rule: ext_ext_fold |
3379 | if (!RuleConfig->isRuleDisabled(59)) { |
3380 | if (1 |
3381 | && [&]() { |
3382 | return Helper.matchCombineExtOfExt(*MIs[0], MatchData59); |
3383 | return true; |
3384 | }() ) { |
3385 | LLVM_DEBUG(dbgs() << "Applying rule 'ext_ext_fold'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'ext_ext_fold'\n" ; } } while (false); |
3386 | Helper.applyCombineExtOfExt(*MIs[0], MatchData59); |
3387 | return true; |
3388 | } |
3389 | } |
3390 | return false; |
3391 | } |
3392 | if (Partition == 47 /* TargetOpcode::G_BR */) { |
3393 | // Leaf name: opt_brcond_by_inverting_cond |
3394 | // Rule: opt_brcond_by_inverting_cond |
3395 | if (!RuleConfig->isRuleDisabled(61)) { |
3396 | if (1 |
3397 | && [&]() { |
3398 | return Helper.matchOptBrCondByInvertingCond(*MIs[0], MatchData61); |
3399 | return true; |
3400 | }() ) { |
3401 | LLVM_DEBUG(dbgs() << "Applying rule 'opt_brcond_by_inverting_cond'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'opt_brcond_by_inverting_cond'\n" ; } } while (false); |
3402 | Helper.applyOptBrCondByInvertingCond(*MIs[0], MatchData61); |
3403 | return true; |
3404 | } |
3405 | } |
3406 | return false; |
3407 | } |
3408 | if (Partition == 48 /* TargetOpcode::G_MERGE_VALUES */) { |
3409 | // Leaf name: merge_unmerge |
3410 | // Rule: merge_unmerge |
3411 | if (!RuleConfig->isRuleDisabled(66)) { |
3412 | if (1 |
3413 | && [&]() { |
3414 | return Helper.matchCombineMergeUnmerge(*MIs[0], MatchData66); |
3415 | return true; |
3416 | }() ) { |
3417 | LLVM_DEBUG(dbgs() << "Applying rule 'merge_unmerge'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'merge_unmerge'\n" ; } } while (false); |
3418 | Helper.replaceSingleDefInstWithReg(*MIs[0], MatchData66); |
3419 | return true; |
3420 | } |
3421 | } |
3422 | return false; |
3423 | } |
3424 | if (Partition == 49 /* TargetOpcode::G_FPTRUNC */) { |
3425 | // Leaf name: constant_fp_op |
3426 | // Rule: constant_fp_op |
3427 | if (!RuleConfig->isRuleDisabled(69)) { |
3428 | if (1 |
3429 | && [&]() { |
3430 | return Helper.matchCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3431 | return true; |
3432 | }() ) { |
3433 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fp_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fp_op'\n" ; } } while (false); |
3434 | Helper.applyCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3435 | return true; |
3436 | } |
3437 | } |
3438 | return false; |
3439 | } |
3440 | if (Partition == 50 /* TargetOpcode::G_FSQRT */) { |
3441 | // Leaf name: constant_fp_op |
3442 | // Rule: constant_fp_op |
3443 | if (!RuleConfig->isRuleDisabled(69)) { |
3444 | if (1 |
3445 | && [&]() { |
3446 | return Helper.matchCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3447 | return true; |
3448 | }() ) { |
3449 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fp_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fp_op'\n" ; } } while (false); |
3450 | Helper.applyCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3451 | return true; |
3452 | } |
3453 | } |
3454 | return false; |
3455 | } |
3456 | if (Partition == 51 /* TargetOpcode::G_FLOG2 */) { |
3457 | // Leaf name: constant_fp_op |
3458 | // Rule: constant_fp_op |
3459 | if (!RuleConfig->isRuleDisabled(69)) { |
3460 | if (1 |
3461 | && [&]() { |
3462 | return Helper.matchCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3463 | return true; |
3464 | }() ) { |
3465 | LLVM_DEBUG(dbgs() << "Applying rule 'constant_fp_op'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'constant_fp_op'\n" ; } } while (false); |
3466 | Helper.applyCombineConstantFoldFpUnary(*MIs[0], MatchData69); |
3467 | return true; |
3468 | } |
3469 | } |
3470 | return false; |
3471 | } |
3472 | if (Partition == 52 /* TargetOpcode::G_UMULO */) { |
3473 | // Leaf name: mulo_by_2 |
3474 | // Rule: mulo_by_2 |
3475 | if (!RuleConfig->isRuleDisabled(72)) { |
3476 | if (1 |
3477 | && [&]() { |
3478 | return Helper.matchMulOBy2(*MIs[0], MatchData72); |
3479 | return true; |
3480 | }() ) { |
3481 | LLVM_DEBUG(dbgs() << "Applying rule 'mulo_by_2'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'mulo_by_2'\n" ; } } while (false); |
3482 | Helper.applyBuildFnNoErase(*MIs[0], MatchData72); |
3483 | return true; |
3484 | } |
3485 | } |
3486 | // Leaf name: mulo_by_0 |
3487 | // Rule: mulo_by_0 |
3488 | if (!RuleConfig->isRuleDisabled(73)) { |
3489 | if (1 |
3490 | && [&]() { |
3491 | return Helper.matchMulOBy0(*MIs[0], MatchData73); |
3492 | return true; |
3493 | }() ) { |
3494 | LLVM_DEBUG(dbgs() << "Applying rule 'mulo_by_0'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'mulo_by_0'\n" ; } } while (false); |
3495 | Helper.applyBuildFn(*MIs[0], MatchData73); |
3496 | return true; |
3497 | } |
3498 | } |
3499 | return false; |
3500 | } |
3501 | if (Partition == 53 /* TargetOpcode::G_SMULO */) { |
3502 | // Leaf name: mulo_by_2 |
3503 | // Rule: mulo_by_2 |
3504 | if (!RuleConfig->isRuleDisabled(72)) { |
3505 | if (1 |
3506 | && [&]() { |
3507 | return Helper.matchMulOBy2(*MIs[0], MatchData72); |
3508 | return true; |
3509 | }() ) { |
3510 | LLVM_DEBUG(dbgs() << "Applying rule 'mulo_by_2'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'mulo_by_2'\n" ; } } while (false); |
3511 | Helper.applyBuildFnNoErase(*MIs[0], MatchData72); |
3512 | return true; |
3513 | } |
3514 | } |
3515 | // Leaf name: mulo_by_0 |
3516 | // Rule: mulo_by_0 |
3517 | if (!RuleConfig->isRuleDisabled(73)) { |
3518 | if (1 |
3519 | && [&]() { |
3520 | return Helper.matchMulOBy0(*MIs[0], MatchData73); |
3521 | return true; |
3522 | }() ) { |
3523 | LLVM_DEBUG(dbgs() << "Applying rule 'mulo_by_0'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'mulo_by_0'\n" ; } } while (false); |
3524 | Helper.applyBuildFn(*MIs[0], MatchData73); |
3525 | return true; |
3526 | } |
3527 | } |
3528 | return false; |
3529 | } |
3530 | if (Partition == 54 /* TargetOpcode::G_UADDO */) { |
3531 | // Leaf name: addo_by_0 |
3532 | // Rule: addo_by_0 |
3533 | if (!RuleConfig->isRuleDisabled(74)) { |
3534 | if (1 |
3535 | && [&]() { |
3536 | return Helper.matchAddOBy0(*MIs[0], MatchData74); |
3537 | return true; |
3538 | }() ) { |
3539 | LLVM_DEBUG(dbgs() << "Applying rule 'addo_by_0'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'addo_by_0'\n" ; } } while (false); |
3540 | Helper.applyBuildFn(*MIs[0], MatchData74); |
3541 | return true; |
3542 | } |
3543 | } |
3544 | return false; |
3545 | } |
3546 | if (Partition == 55 /* TargetOpcode::G_SADDO */) { |
3547 | // Leaf name: addo_by_0 |
3548 | // Rule: addo_by_0 |
3549 | if (!RuleConfig->isRuleDisabled(74)) { |
3550 | if (1 |
3551 | && [&]() { |
3552 | return Helper.matchAddOBy0(*MIs[0], MatchData74); |
3553 | return true; |
3554 | }() ) { |
3555 | LLVM_DEBUG(dbgs() << "Applying rule 'addo_by_0'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'addo_by_0'\n" ; } } while (false); |
3556 | Helper.applyBuildFn(*MIs[0], MatchData74); |
3557 | return true; |
3558 | } |
3559 | } |
3560 | return false; |
3561 | } |
3562 | if (Partition == 56 /* TargetOpcode::G_UADDE */) { |
3563 | // Leaf name: adde_to_addo |
3564 | // Rule: adde_to_addo |
3565 | if (!RuleConfig->isRuleDisabled(75)) { |
3566 | if (1 |
3567 | && [&]() { |
3568 | return Helper.matchAddEToAddO(*MIs[0], MatchData75); |
3569 | return true; |
3570 | }() ) { |
3571 | LLVM_DEBUG(dbgs() << "Applying rule 'adde_to_addo'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'adde_to_addo'\n" ; } } while (false); |
3572 | Helper.applyBuildFnNoErase(*MIs[0], MatchData75); |
3573 | return true; |
3574 | } |
3575 | } |
3576 | return false; |
3577 | } |
3578 | if (Partition == 57 /* TargetOpcode::G_SADDE */) { |
3579 | // Leaf name: adde_to_addo |
3580 | // Rule: adde_to_addo |
3581 | if (!RuleConfig->isRuleDisabled(75)) { |
3582 | if (1 |
3583 | && [&]() { |
3584 | return Helper.matchAddEToAddO(*MIs[0], MatchData75); |
3585 | return true; |
3586 | }() ) { |
3587 | LLVM_DEBUG(dbgs() << "Applying rule 'adde_to_addo'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'adde_to_addo'\n" ; } } while (false); |
3588 | Helper.applyBuildFnNoErase(*MIs[0], MatchData75); |
3589 | return true; |
3590 | } |
3591 | } |
3592 | return false; |
3593 | } |
3594 | if (Partition == 58 /* TargetOpcode::G_USUBE */) { |
3595 | // Leaf name: adde_to_addo |
3596 | // Rule: adde_to_addo |
3597 | if (!RuleConfig->isRuleDisabled(75)) { |
3598 | if (1 |
3599 | && [&]() { |
3600 | return Helper.matchAddEToAddO(*MIs[0], MatchData75); |
3601 | return true; |
3602 | }() ) { |
3603 | LLVM_DEBUG(dbgs() << "Applying rule 'adde_to_addo'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'adde_to_addo'\n" ; } } while (false); |
3604 | Helper.applyBuildFnNoErase(*MIs[0], MatchData75); |
3605 | return true; |
3606 | } |
3607 | } |
3608 | return false; |
3609 | } |
3610 | if (Partition == 59 /* TargetOpcode::G_SSUBE */) { |
3611 | // Leaf name: adde_to_addo |
3612 | // Rule: adde_to_addo |
3613 | if (!RuleConfig->isRuleDisabled(75)) { |
3614 | if (1 |
3615 | && [&]() { |
3616 | return Helper.matchAddEToAddO(*MIs[0], MatchData75); |
3617 | return true; |
3618 | }() ) { |
3619 | LLVM_DEBUG(dbgs() << "Applying rule 'adde_to_addo'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'adde_to_addo'\n" ; } } while (false); |
3620 | Helper.applyBuildFnNoErase(*MIs[0], MatchData75); |
3621 | return true; |
3622 | } |
3623 | } |
3624 | return false; |
3625 | } |
3626 | if (Partition == 60 /* TargetOpcode::G_FMINNUM */) { |
3627 | // Leaf name: combine_minmax_nan |
3628 | // Rule: combine_minmax_nan |
3629 | if (!RuleConfig->isRuleDisabled(76)) { |
3630 | if (1 |
3631 | && [&]() { |
3632 | return Helper.matchCombineFMinMaxNaN(*MIs[0], MatchData76); |
3633 | return true; |
3634 | }() ) { |
3635 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_minmax_nan'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_minmax_nan'\n" ; } } while (false); |
3636 | Helper.replaceSingleDefInstWithOperand(*MIs[0], MatchData76); |
3637 | return true; |
3638 | } |
3639 | } |
3640 | // Leaf name: fold_binop_into_select |
3641 | // Rule: fold_binop_into_select |
3642 | if (!RuleConfig->isRuleDisabled(105)) { |
3643 | if (1 |
3644 | && [&]() { |
3645 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
3646 | return true; |
3647 | }() ) { |
3648 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
3649 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
3650 | return true; |
3651 | } |
3652 | } |
3653 | return false; |
3654 | } |
3655 | if (Partition == 61 /* TargetOpcode::G_FMAXNUM */) { |
3656 | // Leaf name: combine_minmax_nan |
3657 | // Rule: combine_minmax_nan |
3658 | if (!RuleConfig->isRuleDisabled(76)) { |
3659 | if (1 |
3660 | && [&]() { |
3661 | return Helper.matchCombineFMinMaxNaN(*MIs[0], MatchData76); |
3662 | return true; |
3663 | }() ) { |
3664 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_minmax_nan'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_minmax_nan'\n" ; } } while (false); |
3665 | Helper.replaceSingleDefInstWithOperand(*MIs[0], MatchData76); |
3666 | return true; |
3667 | } |
3668 | } |
3669 | // Leaf name: fold_binop_into_select |
3670 | // Rule: fold_binop_into_select |
3671 | if (!RuleConfig->isRuleDisabled(105)) { |
3672 | if (1 |
3673 | && [&]() { |
3674 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
3675 | return true; |
3676 | }() ) { |
3677 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
3678 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
3679 | return true; |
3680 | } |
3681 | } |
3682 | return false; |
3683 | } |
3684 | if (Partition == 62 /* TargetOpcode::G_FMINIMUM */) { |
3685 | // Leaf name: combine_minmax_nan |
3686 | // Rule: combine_minmax_nan |
3687 | if (!RuleConfig->isRuleDisabled(76)) { |
3688 | if (1 |
3689 | && [&]() { |
3690 | return Helper.matchCombineFMinMaxNaN(*MIs[0], MatchData76); |
3691 | return true; |
3692 | }() ) { |
3693 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_minmax_nan'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_minmax_nan'\n" ; } } while (false); |
3694 | Helper.replaceSingleDefInstWithOperand(*MIs[0], MatchData76); |
3695 | return true; |
3696 | } |
3697 | } |
3698 | // Leaf name: fold_binop_into_select |
3699 | // Rule: fold_binop_into_select |
3700 | if (!RuleConfig->isRuleDisabled(105)) { |
3701 | if (1 |
3702 | && [&]() { |
3703 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
3704 | return true; |
3705 | }() ) { |
3706 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
3707 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
3708 | return true; |
3709 | } |
3710 | } |
3711 | return false; |
3712 | } |
3713 | if (Partition == 63 /* TargetOpcode::G_FMAXIMUM */) { |
3714 | // Leaf name: combine_minmax_nan |
3715 | // Rule: combine_minmax_nan |
3716 | if (!RuleConfig->isRuleDisabled(76)) { |
3717 | if (1 |
3718 | && [&]() { |
3719 | return Helper.matchCombineFMinMaxNaN(*MIs[0], MatchData76); |
3720 | return true; |
3721 | }() ) { |
3722 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_minmax_nan'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_minmax_nan'\n" ; } } while (false); |
3723 | Helper.replaceSingleDefInstWithOperand(*MIs[0], MatchData76); |
3724 | return true; |
3725 | } |
3726 | } |
3727 | // Leaf name: fold_binop_into_select |
3728 | // Rule: fold_binop_into_select |
3729 | if (!RuleConfig->isRuleDisabled(105)) { |
3730 | if (1 |
3731 | && [&]() { |
3732 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
3733 | return true; |
3734 | }() ) { |
3735 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
3736 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
3737 | return true; |
3738 | } |
3739 | } |
3740 | return false; |
3741 | } |
3742 | if (Partition == 64 /* TargetOpcode::G_SSHLSAT */) { |
3743 | // Leaf name: shift_immed_chain |
3744 | // Rule: shift_immed_chain |
3745 | if (!RuleConfig->isRuleDisabled(79)) { |
3746 | if (1 |
3747 | && [&]() { |
3748 | return Helper.matchShiftImmedChain(*MIs[0], MatchData79); |
3749 | return true; |
3750 | }() ) { |
3751 | LLVM_DEBUG(dbgs() << "Applying rule 'shift_immed_chain'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shift_immed_chain'\n" ; } } while (false); |
3752 | Helper.applyShiftImmedChain(*MIs[0], MatchData79); |
3753 | return true; |
3754 | } |
3755 | } |
3756 | // Leaf name: shift_of_shifted_logic_chain |
3757 | // Rule: shift_of_shifted_logic_chain |
3758 | if (!RuleConfig->isRuleDisabled(80)) { |
3759 | if (1 |
3760 | && [&]() { |
3761 | return Helper.matchShiftOfShiftedLogic(*MIs[0], MatchData80); |
3762 | return true; |
3763 | }() ) { |
3764 | LLVM_DEBUG(dbgs() << "Applying rule 'shift_of_shifted_logic_chain'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shift_of_shifted_logic_chain'\n" ; } } while (false); |
3765 | Helper.applyShiftOfShiftedLogic(*MIs[0], MatchData80); |
3766 | return true; |
3767 | } |
3768 | } |
3769 | return false; |
3770 | } |
3771 | if (Partition == 65 /* TargetOpcode::G_USHLSAT */) { |
3772 | // Leaf name: shift_immed_chain |
3773 | // Rule: shift_immed_chain |
3774 | if (!RuleConfig->isRuleDisabled(79)) { |
3775 | if (1 |
3776 | && [&]() { |
3777 | return Helper.matchShiftImmedChain(*MIs[0], MatchData79); |
3778 | return true; |
3779 | }() ) { |
3780 | LLVM_DEBUG(dbgs() << "Applying rule 'shift_immed_chain'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shift_immed_chain'\n" ; } } while (false); |
3781 | Helper.applyShiftImmedChain(*MIs[0], MatchData79); |
3782 | return true; |
3783 | } |
3784 | } |
3785 | // Leaf name: shift_of_shifted_logic_chain |
3786 | // Rule: shift_of_shifted_logic_chain |
3787 | if (!RuleConfig->isRuleDisabled(80)) { |
3788 | if (1 |
3789 | && [&]() { |
3790 | return Helper.matchShiftOfShiftedLogic(*MIs[0], MatchData80); |
3791 | return true; |
3792 | }() ) { |
3793 | LLVM_DEBUG(dbgs() << "Applying rule 'shift_of_shifted_logic_chain'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'shift_of_shifted_logic_chain'\n" ; } } while (false); |
3794 | Helper.applyShiftOfShiftedLogic(*MIs[0], MatchData80); |
3795 | return true; |
3796 | } |
3797 | } |
3798 | return false; |
3799 | } |
3800 | if (Partition == 66 /* TargetOpcode::G_FSHL */) { |
3801 | // Leaf name: funnel_shift_to_rotate |
3802 | // Rule: funnel_shift_to_rotate |
3803 | if (!RuleConfig->isRuleDisabled(85)) { |
3804 | if (1 |
3805 | && [&]() { |
3806 | return Helper.matchFunnelShiftToRotate(*MIs[0]); |
3807 | return true; |
3808 | }() ) { |
3809 | LLVM_DEBUG(dbgs() << "Applying rule 'funnel_shift_to_rotate'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'funnel_shift_to_rotate'\n" ; } } while (false); |
3810 | Helper.applyFunnelShiftToRotate(*MIs[0]); |
3811 | return true; |
3812 | } |
3813 | } |
3814 | return false; |
3815 | } |
3816 | if (Partition == 67 /* TargetOpcode::G_FSHR */) { |
3817 | // Leaf name: funnel_shift_to_rotate |
3818 | // Rule: funnel_shift_to_rotate |
3819 | if (!RuleConfig->isRuleDisabled(85)) { |
3820 | if (1 |
3821 | && [&]() { |
3822 | return Helper.matchFunnelShiftToRotate(*MIs[0]); |
3823 | return true; |
3824 | }() ) { |
3825 | LLVM_DEBUG(dbgs() << "Applying rule 'funnel_shift_to_rotate'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'funnel_shift_to_rotate'\n" ; } } while (false); |
3826 | Helper.applyFunnelShiftToRotate(*MIs[0]); |
3827 | return true; |
3828 | } |
3829 | } |
3830 | return false; |
3831 | } |
3832 | if (Partition == 68 /* TargetOpcode::G_UMULH */) { |
3833 | // Leaf name: mulh_to_lshr |
3834 | // Rule: mulh_to_lshr |
3835 | if (!RuleConfig->isRuleDisabled(94)) { |
3836 | if (1 |
3837 | && [&]() { |
3838 | return Helper.matchUMulHToLShr(*MIs[0]); |
3839 | return true; |
3840 | }() ) { |
3841 | LLVM_DEBUG(dbgs() << "Applying rule 'mulh_to_lshr'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'mulh_to_lshr'\n" ; } } while (false); |
3842 | Helper.applyUMulHToLShr(*MIs[0]); |
3843 | return true; |
3844 | } |
3845 | } |
3846 | return false; |
3847 | } |
3848 | if (Partition == 69 /* TargetOpcode::G_FADD */) { |
3849 | // Leaf name: redundant_neg_operands |
3850 | // Rule: redundant_neg_operands |
3851 | if (!RuleConfig->isRuleDisabled(95)) { |
3852 | if (1 |
3853 | && [&]() { |
3854 | return Helper.matchRedundantNegOperands(*MIs[0], MatchData95); |
3855 | return true; |
3856 | }() ) { |
3857 | LLVM_DEBUG(dbgs() << "Applying rule 'redundant_neg_operands'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'redundant_neg_operands'\n" ; } } while (false); |
3858 | Helper.applyBuildFnNoErase(*MIs[0], MatchData95); |
3859 | return true; |
3860 | } |
3861 | } |
3862 | // Leaf name: combine_fadd_fmul_to_fmad_or_fma |
3863 | // Rule: combine_fadd_fmul_to_fmad_or_fma |
3864 | if (!RuleConfig->isRuleDisabled(97)) { |
3865 | if (1 |
3866 | && [&]() { |
3867 | return Helper.matchCombineFAddFMulToFMadOrFMA(*MIs[0], |
3868 | MatchData97); |
3869 | return true; |
3870 | }() ) { |
3871 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_fadd_fmul_to_fmad_or_fma'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_fadd_fmul_to_fmad_or_fma'\n" ; } } while (false); |
3872 | Helper.applyBuildFn(*MIs[0], MatchData97); |
3873 | return true; |
3874 | } |
3875 | } |
3876 | // Leaf name: combine_fadd_fpext_fmul_to_fmad_or_fma |
3877 | // Rule: combine_fadd_fpext_fmul_to_fmad_or_fma |
3878 | if (!RuleConfig->isRuleDisabled(98)) { |
3879 | if (1 |
3880 | && [&]() { |
3881 | return Helper.matchCombineFAddFpExtFMulToFMadOrFMA(*MIs[0], |
3882 | MatchData98); |
3883 | return true; |
3884 | }() ) { |
3885 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_fadd_fpext_fmul_to_fmad_or_fma'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_fadd_fpext_fmul_to_fmad_or_fma'\n" ; } } while (false); |
3886 | Helper.applyBuildFn(*MIs[0], MatchData98); |
3887 | return true; |
3888 | } |
3889 | } |
3890 | // Leaf name: combine_fadd_fma_fmul_to_fmad_or_fma |
3891 | // Rule: combine_fadd_fma_fmul_to_fmad_or_fma |
3892 | if (!RuleConfig->isRuleDisabled(99)) { |
3893 | if (1 |
3894 | && [&]() { |
3895 | return Helper.matchCombineFAddFMAFMulToFMadOrFMA(*MIs[0], |
3896 | MatchData99); |
3897 | return true; |
3898 | }() ) { |
3899 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_fadd_fma_fmul_to_fmad_or_fma'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_fadd_fma_fmul_to_fmad_or_fma'\n" ; } } while (false); |
3900 | Helper.applyBuildFn(*MIs[0], MatchData99); |
3901 | return true; |
3902 | } |
3903 | } |
3904 | // Leaf name: combine_fadd_fpext_fma_fmul_to_fmad_or_fma |
3905 | // Rule: combine_fadd_fpext_fma_fmul_to_fmad_or_fma |
3906 | if (!RuleConfig->isRuleDisabled(100)) { |
3907 | if (1 |
3908 | && [&]() { |
3909 | return Helper.matchCombineFAddFpExtFMulToFMadOrFMAAggressive( |
3910 | *MIs[0], MatchData100); |
3911 | return true; |
3912 | }() ) { |
3913 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_fadd_fpext_fma_fmul_to_fmad_or_fma'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_fadd_fpext_fma_fmul_to_fmad_or_fma'\n" ; } } while (false); |
3914 | Helper.applyBuildFn(*MIs[0], MatchData100); |
3915 | return true; |
3916 | } |
3917 | } |
3918 | // Leaf name: fold_binop_into_select |
3919 | // Rule: fold_binop_into_select |
3920 | if (!RuleConfig->isRuleDisabled(105)) { |
3921 | if (1 |
3922 | && [&]() { |
3923 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
3924 | return true; |
3925 | }() ) { |
3926 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
3927 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
3928 | return true; |
3929 | } |
3930 | } |
3931 | return false; |
3932 | } |
3933 | if (Partition == 70 /* TargetOpcode::G_FSUB */) { |
3934 | // Leaf name: redundant_neg_operands |
3935 | // Rule: redundant_neg_operands |
3936 | if (!RuleConfig->isRuleDisabled(95)) { |
3937 | if (1 |
3938 | && [&]() { |
3939 | return Helper.matchRedundantNegOperands(*MIs[0], MatchData95); |
3940 | return true; |
3941 | }() ) { |
3942 | LLVM_DEBUG(dbgs() << "Applying rule 'redundant_neg_operands'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'redundant_neg_operands'\n" ; } } while (false); |
3943 | Helper.applyBuildFnNoErase(*MIs[0], MatchData95); |
3944 | return true; |
3945 | } |
3946 | } |
3947 | // Leaf name: combine_fsub_fmul_to_fmad_or_fma |
3948 | // Rule: combine_fsub_fmul_to_fmad_or_fma |
3949 | if (!RuleConfig->isRuleDisabled(101)) { |
3950 | if (1 |
3951 | && [&]() { |
3952 | return Helper.matchCombineFSubFMulToFMadOrFMA(*MIs[0], |
3953 | MatchData101); |
3954 | return true; |
3955 | }() ) { |
3956 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_fsub_fmul_to_fmad_or_fma'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_fsub_fmul_to_fmad_or_fma'\n" ; } } while (false); |
3957 | Helper.applyBuildFn(*MIs[0], MatchData101); |
3958 | return true; |
3959 | } |
3960 | } |
3961 | // Leaf name: combine_fsub_fneg_fmul_to_fmad_or_fma |
3962 | // Rule: combine_fsub_fneg_fmul_to_fmad_or_fma |
3963 | if (!RuleConfig->isRuleDisabled(102)) { |
3964 | if (1 |
3965 | && [&]() { |
3966 | return Helper.matchCombineFSubFNegFMulToFMadOrFMA(*MIs[0], |
3967 | MatchData102); |
3968 | return true; |
3969 | }() ) { |
3970 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_fsub_fneg_fmul_to_fmad_or_fma'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_fsub_fneg_fmul_to_fmad_or_fma'\n" ; } } while (false); |
3971 | Helper.applyBuildFn(*MIs[0], MatchData102); |
3972 | return true; |
3973 | } |
3974 | } |
3975 | // Leaf name: combine_fsub_fpext_fmul_to_fmad_or_fma |
3976 | // Rule: combine_fsub_fpext_fmul_to_fmad_or_fma |
3977 | if (!RuleConfig->isRuleDisabled(103)) { |
3978 | if (1 |
3979 | && [&]() { |
3980 | return Helper.matchCombineFSubFpExtFMulToFMadOrFMA(*MIs[0], |
3981 | MatchData103); |
3982 | return true; |
3983 | }() ) { |
3984 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_fsub_fpext_fmul_to_fmad_or_fma'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_fsub_fpext_fmul_to_fmad_or_fma'\n" ; } } while (false); |
3985 | Helper.applyBuildFn(*MIs[0], MatchData103); |
3986 | return true; |
3987 | } |
3988 | } |
3989 | // Leaf name: combine_fsub_fpext_fneg_fmul_to_fmad_or_fma |
3990 | // Rule: combine_fsub_fpext_fneg_fmul_to_fmad_or_fma |
3991 | if (!RuleConfig->isRuleDisabled(104)) { |
3992 | if (1 |
3993 | && [&]() { |
3994 | return Helper.matchCombineFSubFpExtFNegFMulToFMadOrFMA( |
3995 | *MIs[0], MatchData104); |
3996 | return true; |
3997 | }() ) { |
3998 | LLVM_DEBUG(dbgs() << "Applying rule 'combine_fsub_fpext_fneg_fmul_to_fmad_or_fma'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'combine_fsub_fpext_fneg_fmul_to_fmad_or_fma'\n" ; } } while (false); |
3999 | Helper.applyBuildFn(*MIs[0], MatchData104); |
4000 | return true; |
4001 | } |
4002 | } |
4003 | // Leaf name: fold_binop_into_select |
4004 | // Rule: fold_binop_into_select |
4005 | if (!RuleConfig->isRuleDisabled(105)) { |
4006 | if (1 |
4007 | && [&]() { |
4008 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4009 | return true; |
4010 | }() ) { |
4011 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
4012 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4013 | return true; |
4014 | } |
4015 | } |
4016 | // Leaf name: fsub_to_fneg |
4017 | // Rule: fsub_to_fneg |
4018 | if (!RuleConfig->isRuleDisabled(109)) { |
4019 | if (1 |
4020 | && [&]() { |
4021 | return Helper.matchFsubToFneg(*MIs[0], MatchData109); |
4022 | return true; |
4023 | }() ) { |
4024 | LLVM_DEBUG(dbgs() << "Applying rule 'fsub_to_fneg'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fsub_to_fneg'\n" ; } } while (false); |
4025 | Helper.applyFsubToFneg(*MIs[0], MatchData109); |
4026 | return true; |
4027 | } |
4028 | } |
4029 | return false; |
4030 | } |
4031 | if (Partition == 71 /* TargetOpcode::G_FMUL */) { |
4032 | // Leaf name: redundant_neg_operands |
4033 | // Rule: redundant_neg_operands |
4034 | if (!RuleConfig->isRuleDisabled(95)) { |
4035 | if (1 |
4036 | && [&]() { |
4037 | return Helper.matchRedundantNegOperands(*MIs[0], MatchData95); |
4038 | return true; |
4039 | }() ) { |
4040 | LLVM_DEBUG(dbgs() << "Applying rule 'redundant_neg_operands'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'redundant_neg_operands'\n" ; } } while (false); |
4041 | Helper.applyBuildFnNoErase(*MIs[0], MatchData95); |
4042 | return true; |
4043 | } |
4044 | } |
4045 | // Leaf name: fold_binop_into_select |
4046 | // Rule: fold_binop_into_select |
4047 | if (!RuleConfig->isRuleDisabled(105)) { |
4048 | if (1 |
4049 | && [&]() { |
4050 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4051 | return true; |
4052 | }() ) { |
4053 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
4054 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4055 | return true; |
4056 | } |
4057 | } |
4058 | return false; |
4059 | } |
4060 | if (Partition == 72 /* TargetOpcode::G_FDIV */) { |
4061 | // Leaf name: redundant_neg_operands |
4062 | // Rule: redundant_neg_operands |
4063 | if (!RuleConfig->isRuleDisabled(95)) { |
4064 | if (1 |
4065 | && [&]() { |
4066 | return Helper.matchRedundantNegOperands(*MIs[0], MatchData95); |
4067 | return true; |
4068 | }() ) { |
4069 | LLVM_DEBUG(dbgs() << "Applying rule 'redundant_neg_operands'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'redundant_neg_operands'\n" ; } } while (false); |
4070 | Helper.applyBuildFnNoErase(*MIs[0], MatchData95); |
4071 | return true; |
4072 | } |
4073 | } |
4074 | // Leaf name: fold_binop_into_select |
4075 | // Rule: fold_binop_into_select |
4076 | if (!RuleConfig->isRuleDisabled(105)) { |
4077 | if (1 |
4078 | && [&]() { |
4079 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4080 | return true; |
4081 | }() ) { |
4082 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
4083 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4084 | return true; |
4085 | } |
4086 | } |
4087 | return false; |
4088 | } |
4089 | if (Partition == 73 /* TargetOpcode::G_FMAD */) { |
4090 | // Leaf name: redundant_neg_operands |
4091 | // Rule: redundant_neg_operands |
4092 | if (!RuleConfig->isRuleDisabled(95)) { |
4093 | if (1 |
4094 | && [&]() { |
4095 | return Helper.matchRedundantNegOperands(*MIs[0], MatchData95); |
4096 | return true; |
4097 | }() ) { |
4098 | LLVM_DEBUG(dbgs() << "Applying rule 'redundant_neg_operands'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'redundant_neg_operands'\n" ; } } while (false); |
4099 | Helper.applyBuildFnNoErase(*MIs[0], MatchData95); |
4100 | return true; |
4101 | } |
4102 | } |
4103 | return false; |
4104 | } |
4105 | if (Partition == 74 /* TargetOpcode::G_FMA */) { |
4106 | // Leaf name: redundant_neg_operands |
4107 | // Rule: redundant_neg_operands |
4108 | if (!RuleConfig->isRuleDisabled(95)) { |
4109 | if (1 |
4110 | && [&]() { |
4111 | return Helper.matchRedundantNegOperands(*MIs[0], MatchData95); |
4112 | return true; |
4113 | }() ) { |
4114 | LLVM_DEBUG(dbgs() << "Applying rule 'redundant_neg_operands'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'redundant_neg_operands'\n" ; } } while (false); |
4115 | Helper.applyBuildFnNoErase(*MIs[0], MatchData95); |
4116 | return true; |
4117 | } |
4118 | } |
4119 | return false; |
4120 | } |
4121 | if (Partition == 75 /* TargetOpcode::G_SMIN */) { |
4122 | // Leaf name: fold_binop_into_select |
4123 | // Rule: fold_binop_into_select |
4124 | if (!RuleConfig->isRuleDisabled(105)) { |
4125 | if (1 |
4126 | && [&]() { |
4127 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4128 | return true; |
4129 | }() ) { |
4130 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
4131 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4132 | return true; |
4133 | } |
4134 | } |
4135 | return false; |
4136 | } |
4137 | if (Partition == 76 /* TargetOpcode::G_SMAX */) { |
4138 | // Leaf name: fold_binop_into_select |
4139 | // Rule: fold_binop_into_select |
4140 | if (!RuleConfig->isRuleDisabled(105)) { |
4141 | if (1 |
4142 | && [&]() { |
4143 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4144 | return true; |
4145 | }() ) { |
4146 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
4147 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4148 | return true; |
4149 | } |
4150 | } |
4151 | return false; |
4152 | } |
4153 | if (Partition == 77 /* TargetOpcode::G_UMIN */) { |
4154 | // Leaf name: fold_binop_into_select |
4155 | // Rule: fold_binop_into_select |
4156 | if (!RuleConfig->isRuleDisabled(105)) { |
4157 | if (1 |
4158 | && [&]() { |
4159 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4160 | return true; |
4161 | }() ) { |
4162 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
4163 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4164 | return true; |
4165 | } |
4166 | } |
4167 | return false; |
4168 | } |
4169 | if (Partition == 78 /* TargetOpcode::G_UMAX */) { |
4170 | // Leaf name: fold_binop_into_select |
4171 | // Rule: fold_binop_into_select |
4172 | if (!RuleConfig->isRuleDisabled(105)) { |
4173 | if (1 |
4174 | && [&]() { |
4175 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4176 | return true; |
4177 | }() ) { |
4178 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
4179 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4180 | return true; |
4181 | } |
4182 | } |
4183 | return false; |
4184 | } |
4185 | if (Partition == 79 /* TargetOpcode::G_FREM */) { |
4186 | // Leaf name: fold_binop_into_select |
4187 | // Rule: fold_binop_into_select |
4188 | if (!RuleConfig->isRuleDisabled(105)) { |
4189 | if (1 |
4190 | && [&]() { |
4191 | return Helper.matchFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4192 | return true; |
4193 | }() ) { |
4194 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_binop_into_select'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_binop_into_select'\n" ; } } while (false); |
4195 | return Helper.applyFoldBinOpIntoSelect(*MIs[0], MatchData105); |
4196 | return true; |
4197 | } |
4198 | } |
4199 | return false; |
4200 | } |
4201 | if (Partition == 80 /* TargetOpcode::G_FCONSTANT */) { |
4202 | // Leaf name: fconstant_to_constant |
4203 | // Rule: fconstant_to_constant |
4204 | if (!RuleConfig->isRuleDisabled(111)) { |
4205 | if (1 |
4206 | && [&]() { |
4207 | return matchFConstantToConstant(*MIs[0], MRI); |
4208 | return true; |
4209 | }() ) { |
4210 | LLVM_DEBUG(dbgs() << "Applying rule 'fconstant_to_constant'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fconstant_to_constant'\n" ; } } while (false); |
4211 | applyFConstantToConstant(*MIs[0]); |
4212 | return true; |
4213 | } |
4214 | } |
4215 | return false; |
4216 | } |
4217 | if (Partition == 81 /* TargetOpcode::G_GLOBAL_VALUE */) { |
4218 | // Leaf name: fold_global_offset |
4219 | // Rule: fold_global_offset |
4220 | if (!RuleConfig->isRuleDisabled(113)) { |
4221 | if (1 |
4222 | && [&]() { |
4223 | return matchFoldGlobalOffset(*MIs[0], MRI, MatchData113); |
4224 | return true; |
4225 | }() ) { |
4226 | LLVM_DEBUG(dbgs() << "Applying rule 'fold_global_offset'\n")do { if (::llvm::DebugFlag && ::llvm::isCurrentDebugType ("aarch64-prelegalizer-combiner")) { dbgs() << "Applying rule 'fold_global_offset'\n" ; } } while (false); |
4227 | return applyFoldGlobalOffset(*MIs[0], MRI, B, Observer, MatchData113); |
4228 | return true; |
4229 | } |
4230 | } |
4231 | return false; |
4232 | } |
4233 | |
4234 | return false; |
4235 | } |
4236 | #endif // ifdef AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_CPP |