Bug Summary

File:build/source/build-llvm/tools/clang/stage2-bins/lib/Target/AArch64/AArch64GenPreLegalizeGICombiner.inc
Warning:line 2723, column 7
Value stored to 'Partition' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

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