public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Daniel Berlin" <dberlin@dberlin.org>
To: "Richard Guenther" <richard.guenther@gmail.com>
Cc: "Laurent GUERBY" <laurent@guerby.net>,
	 	"Eric Botcazou" <ebotcazou@adacore.com>,
	 	"Andreas Schwab" <schwab@suse.de>,
	gcc-patches@gcc.gnu.org
Subject: Re: [PATCH]: Fix missed PRE optimization discovered
Date: Mon, 20 Oct 2008 20:23:00 -0000	[thread overview]
Message-ID: <4aca3dc20810201251o448aae0cw6fa40fdf8c21c2a8@mail.gmail.com> (raw)
In-Reply-To: <84fc9c000810181051w3de1e256o974c891914a18193@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1457 bytes --]

After bootstrapping and regtesting the variant Richard requested, here
is what i am checking in:

2008-10-20  Daniel Berlin  <dberlin@dberlin.org>

        * tree-ssa-pre.c (insert_into_preds_of_block): Don't rewrite constant
        part of expression.

Sorry about the delay


On Sat, Oct 18, 2008 at 1:51 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Oct 18, 2008 at 7:19 PM, Daniel Berlin <dberlin@dberlin.org> wrote:
>> On Sat, Oct 18, 2008 at 6:27 AM, Richard Guenther
>> <richard.guenther@gmail.com> wrote:
>>> On Sat, Oct 18, 2008 at 4:02 AM, Daniel Berlin <dberlin@dberlin.org> wrote:
>>>> I'm currently testing the following, which at least doesn't crash on
>>>> the minimized testcase i produced :)
>>>
>>> Looking at that patch I wonder if
>>>
>>> -          if (TREE_TYPE (constant) != type)
>>> +         if (!useless_type_conversion_p (type, TREE_TYPE (constant)))
>>>
>>> will also work.
>>
>> Probably, but we really shouldn't just willy nilly replace one with
>> the other anyway. :)
>>
>> If you like, i can try both :)
>
> Yes please ;)
>
>> At worst what is going to happen is that we will call fold_convert a
>> few more times than necessary, and in very strange cases (where
>> converting one constant to the other requires a real conversion),
>> create a small amount of necessary code.
>
> Well, IMHO every time we hit this type-not-compatible case there should
> be a bug elsewhere ...
>
> Richard.
>
>>>
>>
>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: prediff.diff --]
[-- Type: text/x-diff; name=prediff.diff, Size: 1003 bytes --]

Index: tree-ssa-pre.c
===================================================================
--- tree-ssa-pre.c	(revision 141195)
+++ tree-ssa-pre.c	(working copy)
@@ -3019,23 +3019,15 @@ insert_into_preds_of_block (basic_block 
 	     should give us back a constant with the right type.
 	  */
 	  tree constant = PRE_EXPR_CONSTANT (eprime);
-	  if (TREE_TYPE (constant) != type)
+	  if (!useless_type_conversion_p (type, TREE_TYPE (constant)))
 	    {
 	      tree builtexpr = fold_convert (type, constant);
-	      if (is_gimple_min_invariant (builtexpr))
-		{
-		  PRE_EXPR_CONSTANT (eprime) = builtexpr;
-		}
-	      else
+	      if (!is_gimple_min_invariant (builtexpr)) 
 		{
 		  tree forcedexpr = force_gimple_operand (builtexpr,
 							  &stmts, true,
 							  NULL);
-		  if (is_gimple_min_invariant (forcedexpr))
-		    {
-		      PRE_EXPR_CONSTANT (eprime) = forcedexpr;
-		    }
-		  else
+		  if (!is_gimple_min_invariant (forcedexpr))
 		    {
 		      if (forcedexpr != builtexpr)
 			{

  reply	other threads:[~2008-10-20 19:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-16 23:29 Daniel Berlin
2008-10-17 13:05 ` Andreas Schwab
2008-10-17 13:08   ` Eric Botcazou
2008-10-17 15:41     ` Daniel Berlin
2008-10-17 17:08       ` Daniel Berlin
2008-10-17 17:56         ` Daniel Berlin
2008-10-17 19:08         ` Eric Botcazou
2008-10-17 22:24           ` Daniel Berlin
2008-10-17 22:46           ` Laurent GUERBY
2008-10-18 10:28             ` Daniel Berlin
2008-10-18 18:03               ` Richard Guenther
2008-10-18 18:05                 ` Richard Guenther
2008-10-18 23:04                 ` Daniel Berlin
2008-10-19  4:23                   ` Richard Guenther
2008-10-20 20:23                     ` Daniel Berlin [this message]
2008-10-21 12:36                       ` Laurent GUERBY
2008-10-21 13:56                         ` Eric Botcazou
2008-10-21 14:08                           ` Laurent GUERBY
2008-10-21 14:23                             ` Andreas Schwab
2008-10-21 14:45                               ` Laurent GUERBY
2008-10-21 15:01                                 ` Andreas Schwab
2008-10-22 13:57                                   ` Laurent GUERBY
2008-10-22 14:04                                     ` Andreas Schwab
2008-10-22 14:40                                       ` Laurent GUERBY
2008-10-25 23:21                                       ` Ada ACATS random FAIL / scripting help wanted (was:Fix missed PRE optimization discovered) Laurent GUERBY
2008-10-26  0:17                                         ` Andreas Schwab
2008-10-26  0:33                                           ` Laurent GUERBY
2008-11-06 13:36                                             ` Laurent GUERBY
2008-11-06 14:03                                               ` Laurent GUERBY

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=4aca3dc20810201251o448aae0cw6fa40fdf8c21c2a8@mail.gmail.com \
    --to=dberlin@dberlin.org \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=laurent@guerby.net \
    --cc=richard.guenther@gmail.com \
    --cc=schwab@suse.de \
    /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).