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: [PR 84947] Bits propagation only for int and ptr types


On Tue, Apr 3, 2018 at 11:39 AM, Martin Jambor <mjambor@suse.cz> wrote:
> Hi,
>
> PR 84947 shows that when we LTO calls with type-mismatches, we can end
> up doing undefined shifts because we try to work with precision of types
> which do not have any.
>
> Fixed basically in the same way as Martin proposed in Bugzilla, the patch
> below also updates the comment and dump message to reflect that there is
> another reason to bail out early.
>
> LTO-bootstrapped and tested on x86_64-linux, OK for trunk?

OK.

Richard.

> Thanks,
>
> Martin
>
>
> 2018-03-29  Martin Liska  <mliska@suse.cz>
>             Martin Jambor  <mjambor@suse.cz>
>
>         PR ipa/84947
>         * ipa-cp.c (propagate_bits_across_jump_function): Bail out if
>         param_type is not an integral or pointer type.
> ---
>  gcc/ipa-cp.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
> index ee41a8d55b7..ec216010f2f 100644
> --- a/gcc/ipa-cp.c
> +++ b/gcc/ipa-cp.c
> @@ -1811,14 +1811,16 @@ propagate_bits_across_jump_function (cgraph_edge *cs, int idx,
>    struct ipa_node_params *callee_info = IPA_NODE_REF (callee);
>    tree parm_type = ipa_get_type (callee_info, idx);
>
> -  /* For K&R C programs, ipa_get_type() could return NULL_TREE.
> -     Avoid the transform for these cases.  */
> -  if (!parm_type)
> +  /* For K&R C programs, ipa_get_type() could return NULL_TREE.  Avoid the
> +     transform for these cases.  Similarly, we can have bad type mismatches
> +     with LTO, avoid doing anything with those too.  */
> +  if (!parm_type
> +      || (!INTEGRAL_TYPE_P (parm_type) && !POINTER_TYPE_P (parm_type)))
>      {
>        if (dump_file && (dump_flags & TDF_DETAILS))
> -       fprintf (dump_file, "Setting dest_lattice to bottom, because"
> -                           " param %i type is NULL for %s\n", idx,
> -                           cs->callee->name ());
> +       fprintf (dump_file, "Setting dest_lattice to bottom, because type of "
> +                "param %i of %s is NULL or unsuitable for bits propagation\n",
> +                idx, cs->callee->name ());
>
>        return dest_lattice->set_to_bottom ();
>      }
> --
> 2.16.2
>


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