public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/33604] [4.3 Regression] Revision 119502 causes significantly slower results with 4.3 compared to 4.2
Date: Wed, 07 Nov 2007 17:28:00 -0000	[thread overview]
Message-ID: <20071107172811.10636.qmail@sourceware.org> (raw)
In-Reply-To: <bug-33604-15171@http.gcc.gnu.org/bugzilla/>



------- Comment #20 from rguenth at gcc dot gnu dot org  2007-11-07 17:28 -------
Basically things like

  D.2196_13 = (struct Ref *) &D.2150.lhs;
  D.2196_13->m ={v} &I;

where D.2150.lhs is const and thus there is a (not useless) cast from
(const struct Ref *) to (struct Ref *).  So what the code does is to
store to "const" qualified memory:

  D.2150.lhs.m = &I;

of course only as part of constructing it, so it is legal, but the middle-end
cannot tell apart legal from illegal cases.

So we can just declare all of them legal based on the fact that otherwise
this would certainly invoke undefined behavior.  In which case tree-level
forwprop can be teached to disregard conversions that change constness
only on address-forwarding.

Something like a more careful

Index: tree-ssa-forwprop.c
===================================================================
--- tree-ssa-forwprop.c (revision 129897)
+++ tree-ssa-forwprop.c (working copy)
@@ -952,8 +952,14 @@ tree_ssa_forward_propagate_single_use_va
                  continue;
                }

-             if (TREE_CODE (rhs) == ADDR_EXPR)
+             if (TREE_CODE (rhs) == ADDR_EXPR
+                 || ((TREE_CODE (rhs) == NOP_EXPR
+                      || TREE_CODE (rhs) == CONVERT_EXPR)
+                     && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
+                     && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (rhs)))
+                         == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE
(TREE_OPERAND (rhs, 0)))))))
                {
+                 STRIP_NOPS (rhs);
                  if (forward_propagate_addr_expr (lhs, rhs))
                    {
                      release_defs (stmt);


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-11-07 13:09:53         |2007-11-07 17:28:11
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33604


  parent reply	other threads:[~2007-11-07 17:28 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-30 21:13 [Bug c++/33604] New: " michael dot olbrich at gmx dot net
2007-09-30 21:15 ` [Bug c++/33604] " michael dot olbrich at gmx dot net
2007-10-01  9:47 ` rguenth at gcc dot gnu dot org
2007-10-01 21:03 ` [Bug c++/33604] [4.3 Regression] Revision 119502 causes " hjl at lucon dot org
2007-10-01 21:04 ` hjl at lucon dot org
2007-10-01 21:07   ` Daniel Berlin
2007-10-01 21:07 ` dberlin at dberlin dot org
2007-10-22  8:33 ` pinskia at gcc dot gnu dot org
2007-11-05  1:47 ` mmitchel at gcc dot gnu dot org
2007-11-06 17:10 ` bonzini at gnu dot org
2007-11-06 18:55 ` michael dot olbrich at gmx dot net
2007-11-06 20:08 ` bonzini at gnu dot org
2007-11-06 21:01 ` michael dot olbrich at gmx dot net
2007-11-06 21:23 ` bonzini at gnu dot org
2007-11-06 21:51 ` [Bug tree-optimization/33604] " rguenth at gcc dot gnu dot org
2007-11-07  6:03 ` paolo dot bonzini at lu dot unisi dot ch
2007-11-07 12:14 ` dnovillo at google dot com
2007-11-07 13:09 ` bonzini at gnu dot org
2007-11-07 13:10 ` bonzini at gnu dot org
2007-11-07 14:22 ` bonzini at gnu dot org
2007-11-07 16:03 ` bonzini at gnu dot org
2007-11-07 16:26 ` bonzini at gnu dot org
2007-11-07 16:36 ` bonzini at gnu dot org
2007-11-07 17:28 ` rguenth at gcc dot gnu dot org [this message]
2007-11-07 20:59 ` jacob at math dot jussieu dot fr
2007-11-08  6:12 ` paolo dot bonzini at lu dot unisi dot ch
2007-11-09 12:32 ` rguenth at gcc dot gnu dot org
2007-11-09 12:33 ` rguenth at gcc dot gnu dot org
2007-11-09 12:49 ` jacob at math dot jussieu dot fr
2007-11-09 12:52 ` rguenther at suse dot de
2007-11-09 12:56 ` jacob at math dot jussieu dot fr
2007-12-04 10:56 ` michael dot olbrich at gmx dot net
2007-12-04 11:18 ` bonzini at gnu dot org
2007-12-04 11:21 ` rguenth at gcc dot gnu dot org
2007-12-04 12:17 ` michael dot olbrich at gmx dot net
2007-12-04 12:38 ` paolo dot bonzini at lu dot unisi dot ch
2008-01-02 11:17 ` rguenth at gcc dot gnu dot org
2008-02-27 16:36 ` [Bug tree-optimization/33604] [4.3/4.4 Regression] Revision 119502 causes significantly slower results with 4.3/4.4 " jacob at math dot jussieu dot fr
2008-02-27 16:44 ` [Bug target/33604] " pinskia at gcc dot gnu dot org
2008-02-27 16:59 ` jacob at math dot jussieu dot fr
2008-02-27 17:06 ` bonzini at gnu dot org
2008-03-02 12:15 ` michael dot olbrich at gmx dot net
2008-03-02 12:27 ` bonzini at gnu dot org
2008-03-02 14:01 ` rguenth at gcc dot gnu dot org
2008-03-14 17:03 ` rguenth at gcc dot gnu dot org
2008-06-06 15:00 ` rguenth at gcc dot gnu dot org
2008-08-27 22:05 ` jsm28 at gcc dot gnu dot org
2008-08-29 13:14 ` amonakov at gcc dot gnu dot org
2008-12-25 18:14 ` pinskia at gcc dot gnu dot org
2008-12-30  1:50 ` Joey dot ye at intel dot com
2008-12-30  8:04 ` bonzini at gnu dot org
2009-01-24 10:28 ` rguenth at gcc dot gnu dot org
2009-02-01  8:14 ` bonzini at gnu dot org
2009-02-01 10:45 ` rguenth at gcc dot gnu dot org

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=20071107172811.10636.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).