From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115014 invoked by alias); 16 Jun 2015 16:54:49 -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 114742 invoked by uid 48); 16 Jun 2015 16:54:45 -0000 From: "alalaw01 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/51848] GCC is not able to vectorize when a constant value is also added to the sum of array expression inside a loop. Date: Tue, 16 Jun 2015 16:54: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.7.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: alalaw01 at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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: 2015-06/txt/msg01451.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51848 alalaw01 at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alalaw01 at gcc dot gnu.org --- Comment #5 from alalaw01 at gcc dot gnu.org --- (In reply to Richard Biener from comment #3) > (In reply to comment #2) > > We don't recognize this as reduction because we look for: > > > > a1 = phi < a0, a2 > > > a3 = ... > > a2 = operation (a3, a1) > > > > and here we have > > > > a1 = phi < a0, a2 > > > a3 = ... > > a4 = operation (a3, a1) > > a2 = a4 + 1 > > It seems reassociation should "fix" this. IIRC we had some special code > in there that was supposed to handle this. We do reassociate equivalent functions in C, for example float x[30]; float bar() { float s = 0; for (int i = 0; i < 30; i++) { s += x[i]; s += 1; } return s; } which vectorizes just fine.