From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16590 invoked by alias); 26 Sep 2013 09:23:54 -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 16544 invoked by uid 48); 26 Sep 2013 09:23:50 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/57223] Auto-vectorization fails for nested multiple loops depending on type of array Date: Thu, 26 Sep 2013 09:23: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.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 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: 2013-09/txt/msg01830.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57223 --- Comment #4 from Richard Biener --- (In reply to Usishchev Yury from comment #3) > I'm testing it on current trunk, and second loop is not vectorized both with > floating point and integer types. > For floating point types it is not vectorized due to control flow in loop: > > : > // ... > if (t_56 > _61) > goto ; > else > goto ; > : > : > # iftmp.2_7 = PHI <_61(16), t_56(15)> > > This can be optimized to MIN_EXPR in phiopt pass, but is not because of NaNs: > > tree-ssa-phiopt.c:876: > /* The optimization may be unsafe due to NaNs. */ > if (HONOR_NANS (TYPE_MODE (type))) > return false; > > If compiled with -ffinite-math-only second loop still is not vectorised: > > not_always_good.c:16:7: note: not vectorized: latch block not empty. > > (same occurs with integer types). Latch block it that case is: > > : > pretmp_176 = *prephitmp_173; > goto ; > > the statement here is generated in pre pass. > > For vectorization to work we can either not generate it in pre or move it > into head of the loop in vectorizer. > > Right now i'm trying to find how to prevent pre from generating statements > in empty latch blocks. It already has code to avoid this in some situations.