From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9920 invoked by alias); 10 Jun 2011 09:14:34 -0000 Received: (qmail 9911 invoked by uid 22791); 10 Jun 2011 09:14:33 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_TM X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Jun 2011 09:14:18 +0000 Received: by wwf26 with SMTP id 26so2285600wwf.8 for ; Fri, 10 Jun 2011 02:14:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.199.19 with SMTP id eq19mr1876397wbb.75.1307697257593; Fri, 10 Jun 2011 02:14:17 -0700 (PDT) Received: by 10.227.37.152 with HTTP; Fri, 10 Jun 2011 02:14:17 -0700 (PDT) In-Reply-To: References: Date: Fri, 10 Jun 2011 09:23:00 -0000 Message-ID: Subject: Re: [patch] Fix PR tree-optimization/49318 From: Richard Guenther To: Ira Rosen Cc: gcc-patches@gcc.gnu.org, Patch Tracking Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00811.txt.bz2 On Fri, Jun 10, 2011 at 9:19 AM, Ira Rosen wrote: > Hi, > > The test in PR 49318 fails because the vectorizer recognizes address > computation sequence as a widening-multiplication pattern, while such > sequence is not relevant to vectorization. The problem is that the > vectorizer doesn't check if a statement is going to be vectorized > before replacing it with a pattern. Moreover, the vectorizer first > detects the patterns and only after that looks for relevant > statements. Changing the order is not a good option, since statements > relevance is defined also by their belonging to a pattern. > > This patch solves the problem by removing pattern statements that were > created for statements that are not supposed to be vectorized. > > Bootstrapped with vectorization enabled on powerpc64-suse-linux and > tested on powerpc64-suse-linux and x86_64-suse-linux. > Committed. Ick, yeah. I remember running into this ordering issue when doing the multi-vector size reorgs... In the end I think we should not generate the pattern stmt during pattern matching but only mark the relevant statements with a pattern kind. Say, for each pattern we have a "main" statement that has related stmts belonging to the pattern that define uses of the "main" statement - mark those to refer to that "main" statement. For that "main" statement simply record an enum value, like, widening_mult. Then only at vectorized statement generation time actually generate the vectorized form of the pattern statement. Thus, the non-vectorized pattern statements would never be generated. So, separate analysis and transform more properly. Of course I didn't get around to implement the above ... (we'd have a new vectorizable_pattern worker). Richard. > Ira > > ChangeLog: > > =A0 =A0 PR tree-optimization/49318 > =A0 =A0 * tree-vect-loop.c (vect_determine_vectorization_factor): > =A0 =A0 Remove irrelevant pattern statements. > > testsuite/ChangeLog: > > =A0 =A0 PR tree-optimization/49318 > =A0 =A0 * gcc.dg/vect/pr49318.c: New test. >