From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10682 invoked by alias); 7 Nov 2007 17:28:25 -0000 Received: (qmail 10637 invoked by uid 48); 7 Nov 2007 17:28:11 -0000 Date: Wed, 07 Nov 2007 17:28:00 -0000 Message-ID: <20071107172811.10636.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/33604] [4.3 Regression] Revision 119502 causes significantly slower results with 4.3 compared to 4.2 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-11/txt/msg00599.txt.bz2 ------- 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