This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/33604] [4.3 Regression] Revision 119502 causes significantly slower results with 4.3 compared to 4.2



------- 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


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