This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Protect tree_to_shwi call in unmodified_param_1


On Mon, Aug 5, 2019 at 10:58 AM Richard Sandiford
<richard.sandiford@arm.com> wrote:
>
> unmodified_param_1 used tree_to_shwi without first checking
> tree_fits_shwi_p.  This is needed by the SVE ACLE support and
> is hard to test independently.
>
> Tested on aarch64-linux-gnu, armeb-eabi and x86_64-linux-gnu.
> OK to install?

Hmm, a better fix would be to use poly_X for *size_p.  There are also
quite a number of callers with NULL size_p which you unduly
pessimize for SVE.

So, move the check to the if (size_p) case and add a FIXME
about SVE regs and poly_*?

OK with that.

Richard.

> Richard
>
>
> 2019-08-05  Richard Sandiford  <richard.sandiford@arm.com>
>
> gcc/
>         * ipa-fnsummary.c (unmodified_parm_1): Test tree_fits_shwi_p
>         before calling to tree_to_shwi.
>
> Index: gcc/ipa-fnsummary.c
> ===================================================================
> --- gcc/ipa-fnsummary.c 2019-07-16 09:11:50.509067138 +0100
> +++ gcc/ipa-fnsummary.c 2019-08-05 09:57:28.553617299 +0100
> @@ -927,7 +927,8 @@ unmodified_parm_1 (ipa_func_body_info *f
>    /* SSA_NAME referring to parm default def?  */
>    if (TREE_CODE (op) == SSA_NAME
>        && SSA_NAME_IS_DEFAULT_DEF (op)
> -      && TREE_CODE (SSA_NAME_VAR (op)) == PARM_DECL)
> +      && TREE_CODE (SSA_NAME_VAR (op)) == PARM_DECL
> +      && tree_fits_shwi_p (TYPE_SIZE (TREE_TYPE (op))))
>      {
>        if (size_p)
>         *size_p = tree_to_shwi (TYPE_SIZE (TREE_TYPE (op)));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]