From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22683 invoked by alias); 8 Jan 2014 13:08:48 -0000 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 Received: (qmail 22622 invoked by uid 48); 8 Jan 2014 13:08:44 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/59715] [4.7/4.8/4.9 Regression] wrong code at -Os and above on x86_64-linux-gnu Date: Wed, 08 Jan 2014 13:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg00772.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59715 --- Comment #8 from Richard Biener --- virtual SSA form is broken, we have overlapping life-ranges - a virtual PHI node is missing in bb 6, seems to be broken by store sinking (-fno-tree-sink fixes it). The virtual SSA form updating is too simple: /* Update virtual operands of statements in the path we do not sink to. */ if (gimple_vdef (stmt)) { imm_use_iterator iter; use_operand_p use_p; gimple vuse_stmt; FOR_EACH_IMM_USE_STMT (vuse_stmt, iter, gimple_vdef (stmt)) if (gimple_code (vuse_stmt) != GIMPLE_PHI) FOR_EACH_IMM_USE_ON_STMT (use_p, iter) SET_USE (use_p, gimple_vuse (stmt)); } as in this case we sink store | \ x | / \ | / \ y --- / \ needed-here \ but not here sinking assumes that critical edges are split - but tail-merging breaks this assumption, breaking sinking. With critical edges split we can insert on the edge to needed-here. Either dumb down sinking (detect the critical edge case and don't sink), make it insert on edges instead, or restore previous behavior to have critical edges split after PRE (note it may be already partly broken before as cfg-cleanup unsplits edges again). So it is tail-merging introducing this after all, but not necessarily tail-mergings fault.