On Fri, Feb 04, 2022 at 11:14:05AM +0100, Eric Botcazou wrote:
> > > --- a/gcc/match.pd
> > > +++ b/gcc/match.pd
> > > @@ -401,27 +401,35 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
> > >
> > > /* X / bool_range_Y is X. */
> > > (simplify
> > >
> > > (div @0 SSA_NAME@1)
> > >
> > > - (if (INTEGRAL_TYPE_P (type) && ssa_name_has_boolean_range (@1))
> > > + (if (INTEGRAL_TYPE_P (type)
> > > + && ssa_name_has_boolean_range (@1)
> > > + && !flag_non_call_exceptions)
> >
> > ssa_name_has_boolean_range call is certainly more expensive than
> > !flag_non_call_exceptions check, can you swap those two?
>
> But !flag_non_call_exceptions is (almost) always true for the C family of
> languages, so you're going to penalize them by doing this.
True, but much less so than the other order penalizing Ada/Go.
> > And similarly, TYPE_PRECISION (type) > 1 check is very cheap, can
> > it be done before the && !integer_zerop (@1) line?
>
> Yes, it clearly belongs there.
Jakub