On Tue, Sep 03, 2024 at 10:42:34AM +0200, Richard Biener wrote:
> The following moves the assert on NUM_POLY_INT_COEFFS != 1 after
> INTEGER_CST processing.
> 
> Bootstrap and regtest running on x86_64-unknown-linux-gnu, pushed
> as obvious after getting into stage3.
> 
>       * fold-const.cc (poly_int_binop): Move assert on
>       NUM_POLY_INT_COEFFS after INTEGER_CST processing.
> ---
>  gcc/fold-const.cc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
> index 2ada59f712b..70db16759d0 100644
> --- a/gcc/fold-const.cc
> +++ b/gcc/fold-const.cc
> @@ -1241,7 +1241,6 @@ poly_int_binop (poly_wide_int &res, enum tree_code code,
>               const_tree arg1, const_tree arg2,
>               signop sign, wi::overflow_type *overflow)
>  {
> -  gcc_assert (NUM_POLY_INT_COEFFS != 1);
>    gcc_assert (poly_int_tree_p (arg1) && poly_int_tree_p (arg2));

Even the other assert is just a waste of time in the
  if (TREE_CODE (arg1) == INTEGER_CST && TREE_CODE (arg2) == INTEGER_CST)
case.

>    if (TREE_CODE (arg1) == INTEGER_CST && TREE_CODE (arg2) == INTEGER_CST)
> @@ -1254,6 +1253,8 @@ poly_int_binop (poly_wide_int &res, enum tree_code code,
>        return true;
>      }
>  
> +  gcc_assert (NUM_POLY_INT_COEFFS != 1);
> +
>    switch (code)
>      {
>      case PLUS_EXPR:
> -- 
> 2.43.0

        Jakub

Reply via email to