[PATCH] tree-ssa-mathopts: Use proper poly_int64 comparison with param_avoid_fma_max_bits [PR 98766]

Richard Sandiford richard.sandiford@arm.com
Fri Jan 22 13:08:58 GMT 2021


Kyrylo Tkachov via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
> index d6201d3cb943e145720c18fbf3aadd853fd87b44..800815b855c759075b4326361cc4db7183f1c543 100644
> --- a/gcc/tree-ssa-math-opts.c
> +++ b/gcc/tree-ssa-math-opts.c
> @@ -3252,8 +3252,8 @@ convert_mult_to_fma (gimple *mul_stmt, tree op1, tree op2,
>  
>    bool check_defer
>      = (state->m_deferring_p
> -       && (tree_to_shwi (TYPE_SIZE (type))
> -	   <= param_avoid_fma_max_bits));
> +       && known_le (tree_to_poly_int64 (TYPE_SIZE (type)),
> +		    param_avoid_fma_max_bits));

I'd suggest maybe_le here instead.  I.e. instead of the current
“don't do this if the vector length is X” have “don't do this if
the vector length might be X”.

OK from my point of view with that change.

Thanks,
Richard

>    bool defer = check_defer;
>    bool seen_negate_p = false;
>    /* Make sure that the multiplication statement becomes dead after


More information about the Gcc-patches mailing list