@@ -1007,9 +1007,6 @@ def double_icmp_zero_or_combine: GICombineRule<
10071007 (G_ICMP $root, $p, $ordst, 0))
10081008>;
10091009
1010- def double_icmp_zero_and_or_combine : GICombineGroup<[double_icmp_zero_and_combine,
1011- double_icmp_zero_or_combine]>;
1012-
10131010def and_or_disjoint_mask : GICombineRule<
10141011 (defs root:$root, build_fn_matchinfo:$info),
10151012 (match (wip_match_opcode G_AND):$root,
@@ -1918,6 +1915,20 @@ def cast_combines: GICombineGroup<[
19181915 integer_of_truncate
19191916]>;
19201917
1918+ def canonicalize_icmp : GICombineRule<
1919+ (defs root:$root, build_fn_matchinfo:$matchinfo),
1920+ (match (G_ICMP $root, $pred, $lhs, $rhs):$cmp,
1921+ [{ return Helper.matchCanonicalizeICmp(*${cmp}, ${matchinfo}); }]),
1922+ (apply [{ Helper.applyBuildFn(*${cmp}, ${matchinfo}); }])>;
1923+
1924+ def icmp_combines: GICombineGroup<[
1925+ canonicalize_icmp,
1926+ icmp_to_true_false_known_bits,
1927+ icmp_to_lhs_known_bits,
1928+ double_icmp_zero_and_combine,
1929+ double_icmp_zero_or_combine,
1930+ redundant_binop_in_equality
1931+ ]>;
19211932
19221933// FIXME: These should use the custom predicate feature once it lands.
19231934def undef_combines : GICombineGroup<[undef_to_fp_zero, undef_to_int_zero,
@@ -1951,7 +1962,7 @@ def const_combines : GICombineGroup<[constant_fold_fp_ops, const_ptradd_to_i2p,
19511962
19521963def known_bits_simplifications : GICombineGroup<[
19531964 redundant_and, redundant_sext_inreg, redundant_or, urem_pow2_to_mask,
1954- zext_trunc_fold, icmp_to_true_false_known_bits, icmp_to_lhs_known_bits,
1965+ zext_trunc_fold,
19551966 sext_inreg_to_zext_inreg]>;
19561967
19571968def width_reduction_combines : GICombineGroup<[reduce_shl_of_extend,
@@ -1984,7 +1995,7 @@ def all_combines : GICombineGroup<[integer_reassoc_combines, trivial_combines,
19841995 combine_extracted_vector_load,
19851996 undef_combines, identity_combines, phi_combines,
19861997 simplify_add_to_sub, hoist_logic_op_with_same_opcode_hands, shifts_too_big,
1987- reassocs, ptr_add_immed_chain,
1998+ reassocs, ptr_add_immed_chain, icmp_combines,
19881999 shl_ashr_to_sext_inreg, sext_inreg_of_load,
19892000 width_reduction_combines, select_combines,
19902001 known_bits_simplifications,
@@ -1998,9 +2009,9 @@ def all_combines : GICombineGroup<[integer_reassoc_combines, trivial_combines,
19982009 constant_fold_cast_op, fabs_fneg_fold,
19992010 intdiv_combines, mulh_combines, redundant_neg_operands,
20002011 and_or_disjoint_mask, fma_combines, fold_binop_into_select,
2001- sub_add_reg, select_to_minmax, redundant_binop_in_equality,
2012+ sub_add_reg, select_to_minmax,
20022013 fsub_to_fneg, commute_constant_to_rhs, match_ands, match_ors,
2003- combine_concat_vector, double_icmp_zero_and_or_combine, match_addos,
2014+ combine_concat_vector, match_addos,
20042015 sext_trunc, zext_trunc, prefer_sign_combines, combine_shuffle_concat]>;
20052016
20062017// A combine group used to for prelegalizer combiners at -O0. The combines in
0 commit comments