https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117322
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |122186
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #4)
> diff --git a/gcc/match.pd b/gcc/match.pd
> index 8910591a04b..7cc16ac2fc3 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -2885,7 +2885,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
> (for op (eq ne)
> (simplify
> (op (pointer_plus @0 @1) (pointer_plus @0 @2))
> - (op @1 @2)))
> + (op @1 @2))
> + (simplify
> + (op:c (pointer_plus @0 @1) @0)
> + (op @1 { build_zero_cst (TREE_TYPE (@1)); })))
> (simplify
> (pointer_diff (pointer_plus @0 @1) (pointer_plus @0 @2))
> (if (TYPE_OVERFLOW_WRAPS (TREE_TYPE (@1)))
>
> fixes part of it, but there's remains of fold_comparison that still seem
> important and incomplete WRT range info.
There is already a similar pattern that would handle the above case BUT it has
single_use on it, see PR 122186.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122186
[Bug 122186] single_use is too much on some match patterns