From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30749 invoked by alias); 23 Jun 2014 14:13:06 -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 30707 invoked by uid 48); 23 Jun 2014 14:13:01 -0000 From: "ysrumyan at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/61576] [4.10 Regression] wrong code at -O3 on x86_64-linux-gnu Date: Mon, 23 Jun 2014 14:13: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.10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ysrumyan at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.10.0 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-06/txt/msg01782.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61576 --- Comment #4 from Yuri Rumyantsev --- There is an issue with phi-node and reduction stmt - after r211302 new hammock was inserted between reduction stmt and bb containing phi: : d.6_12 = d_lsm.14_17 + 1; if (c.8_13 != 0) goto ; else goto ; : : # iftmp.7_15 = PHI <1(7), _19(6)> : # d_lsm.14_16 = PHI but algorithm for converting conditional scalar reduction assumes that basic block containing reduction is one of predecessors of phi-block. I added check on it and test is passed. BTW I wonder why such code motion has been done - in fact, redundant computations were introduced in loop, before this fix all computations related to hammock were hoisted out off loop: : d_lsm.14_25 = d; c.8_13 = c; f.9_14 = f; _18 = f.9_14 != 0; _19 = (int) _18; iftmp.7_15 = c.8_13 != 0 ? 1 : _19; e_lsm.15_26 = e; : # d_lsm.14_17 = PHI # e_lsm.15_1 = PHI b.4_10 ={v} b; if (b.4_10 != 0) goto ; else goto ; : d.6_12 = d_lsm.14_17 + 1; : # d_lsm.14_16 = PHI # e_lsm.15_24 = PHI I will send for review patch after required testing completion.