public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>, Jan Hubicka <hubicka@ucw.cz>
Subject: Re: [PATCH, PR 64153] Check type sizes before V_C_Eing in evaluate_conditions_for_known_args
Date: Tue, 02 Dec 2014 20:44:00 -0000	[thread overview]
Message-ID: <20141202204431.GC18763@kam.mff.cuni.cz> (raw)
In-Reply-To: <20141202203246.GK8214@virgil.suse>

> Hi,
> 
> apparently it is necessary to check that type sizes match before
> attempting to fold-V_C_E them in evaluate_conditions_for_known_args.
> So this patch does this.
> 
> It passes bootstrap and testing on x86_64-linux and I have verified
> with a cross compiler that the reported bug is fixed (the generated
> assembly is the same as before the commit which introduced the
> problem).
> 
> OK for trunk and (after a bootstrap and testing there) the 4.9 branch?
> 
> Thanks,
> 
> Martin
> 
> 
> 2014-12-02  Martin Jambor  <mjambor@suse.cz>
> 
> 	PR ipa/64153
> 	* ipa-inline-analysis.c (evaluate_conditions_for_known_args): Check
> 	type sizes before view_converting.

OK,
Honza
> 
> Index: src/gcc/ipa-inline-analysis.c
> ===================================================================
> --- src.orig/gcc/ipa-inline-analysis.c
> +++ src/gcc/ipa-inline-analysis.c
> @@ -880,12 +880,19 @@ evaluate_conditions_for_known_args (stru
>  	}
>        if (c->code == IS_NOT_CONSTANT || c->code == CHANGED)
>  	continue;
> -      val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (c->val), val);
> -      res = val
> -	? fold_binary_to_constant (c->code, boolean_type_node, val, c->val)
> -	: NULL;
> -      if (res && integer_zerop (res))
> -	continue;
> +
> +      if (operand_equal_p (TYPE_SIZE (TREE_TYPE (c->val)),
> +			   TYPE_SIZE (TREE_TYPE (val)), 0))
> +	{
> +	  val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (c->val), val);
> +
> +	  res = val
> +	    ? fold_binary_to_constant (c->code, boolean_type_node, val, c->val)
> +	    : NULL;
> +
> +	  if (res && integer_zerop (res))
> +	    continue;
> +	}
>        clause |= 1 << (i + predicate_first_dynamic_condition);
>      }
>    return clause;

  reply	other threads:[~2014-12-02 20:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 20:32 Martin Jambor
2014-12-02 20:44 ` Jan Hubicka [this message]
2014-12-03  9:33 ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141202204431.GC18763@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).