@@ -1007,9 +1007,6 @@ def double_icmp_zero_or_combine: GICombineRule<
1007
1007
(G_ICMP $root, $p, $ordst, 0))
1008
1008
>;
1009
1009
1010
- def double_icmp_zero_and_or_combine : GICombineGroup<[double_icmp_zero_and_combine,
1011
- double_icmp_zero_or_combine]>;
1012
-
1013
1010
def and_or_disjoint_mask : GICombineRule<
1014
1011
(defs root:$root, build_fn_matchinfo:$info),
1015
1012
(match (wip_match_opcode G_AND):$root,
@@ -1918,6 +1915,20 @@ def cast_combines: GICombineGroup<[
1918
1915
integer_of_truncate
1919
1916
]>;
1920
1917
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
+ ]>;
1921
1932
1922
1933
// FIXME: These should use the custom predicate feature once it lands.
1923
1934
def 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,
1951
1962
1952
1963
def known_bits_simplifications : GICombineGroup<[
1953
1964
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,
1955
1966
sext_inreg_to_zext_inreg]>;
1956
1967
1957
1968
def width_reduction_combines : GICombineGroup<[reduce_shl_of_extend,
@@ -1984,7 +1995,7 @@ def all_combines : GICombineGroup<[integer_reassoc_combines, trivial_combines,
1984
1995
combine_extracted_vector_load,
1985
1996
undef_combines, identity_combines, phi_combines,
1986
1997
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,
1988
1999
shl_ashr_to_sext_inreg, sext_inreg_of_load,
1989
2000
width_reduction_combines, select_combines,
1990
2001
known_bits_simplifications,
@@ -1998,9 +2009,9 @@ def all_combines : GICombineGroup<[integer_reassoc_combines, trivial_combines,
1998
2009
constant_fold_cast_op, fabs_fneg_fold,
1999
2010
intdiv_combines, mulh_combines, redundant_neg_operands,
2000
2011
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,
2002
2013
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,
2004
2015
sext_trunc, zext_trunc, prefer_sign_combines, combine_shuffle_concat]>;
2005
2016
2006
2017
// A combine group used to for prelegalizer combiners at -O0. The combines in
0 commit comments