From patchwork Thu Aug 12 17:12:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fang, Changpeng" X-Patchwork-Id: 61630 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 6CE1FB70CD for ; Fri, 13 Aug 2010 03:15:35 +1000 (EST) Received: (qmail 14083 invoked by alias); 12 Aug 2010 17:15:32 -0000 Received: (qmail 14071 invoked by uid 22791); 12 Aug 2010 17:15:29 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, TW_TM X-Spam-Check-By: sourceware.org Received: from tx2ehsobe003.messaging.microsoft.com (HELO TX2EHSOBE006.bigfish.com) (65.55.88.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Aug 2010 17:15:20 +0000 Received: from mail109-tx2-R.bigfish.com (10.9.14.248) by TX2EHSOBE006.bigfish.com (10.9.40.26) with Microsoft SMTP Server id 8.1.340.0; Thu, 12 Aug 2010 17:15:18 +0000 Received: from mail109-tx2 (localhost.localdomain [127.0.0.1]) by mail109-tx2-R.bigfish.com (Postfix) with ESMTP id E9132BE80BA; Thu, 12 Aug 2010 17:15:18 +0000 (UTC) X-SpamScore: -22 X-BigFish: VPS-22(zz1432N936eM4015L9371Pzz1202hzzz32i2a8h34h61h) X-Spam-TCS-SCL: 0:0 Received: from mail109-tx2 (localhost.localdomain [127.0.0.1]) by mail109-tx2 (MessageSwitch) id 1281633318401869_25638; Thu, 12 Aug 2010 17:15:18 +0000 (UTC) Received: from TX2EHSMHS042.bigfish.com (unknown [10.9.14.249]) by mail109-tx2.bigfish.com (Postfix) with ESMTP id 5FBFCE90050; Thu, 12 Aug 2010 17:15:18 +0000 (UTC) Received: from ausb3extmailp02.amd.com (163.181.251.22) by TX2EHSMHS042.bigfish.com (10.9.99.142) with Microsoft SMTP Server (TLS) id 14.0.482.44; Thu, 12 Aug 2010 17:15:17 +0000 Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with SMTP id o7CHD66Q025754; Thu, 12 Aug 2010 12:13:09 -0500 X-M-MSG: Received: from sausexhtp02.amd.com (sausexhtp02.amd.com [163.181.3.152]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2ACDCC86F2; Thu, 12 Aug 2010 12:11:57 -0500 (CDT) Received: from SAUSEXMBP01.amd.com ([163.181.3.198]) by sausexhtp02.amd.com ([163.181.3.152]) with mapi; Thu, 12 Aug 2010 12:12:03 -0500 From: "Fang, Changpeng" To: Ira Rosen CC: "gcc-patches@gcc.gnu.org" Date: Thu, 12 Aug 2010 12:12:02 -0500 Subject: RE: [Patch PR 45241]: CPU2006 465.tonto ICE in the vectorizer with -fno-tree-pre Message-ID: References: , In-Reply-To: MIME-Version: 1.0 X-Reverse-DNS: ausb3extmailp02.amd.com Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, Ira: Thanks for your reviews. Attached is the updated patch. It passed bootstrapping on x86_64-unknown-linux-gnu and the gcc regression tests (fixed PR 45241). Since bug 45241 is a [4.5/4.6] regression, is it ok to commit to 4.5 branch and 4.6 trunk? Thanks, Changpeng From 075b88a514233e5c0ff877ddb27e756641b330d1 Mon Sep 17 00:00:00 2001 From: Changpeng Fang Date: Thu, 12 Aug 2010 10:08:54 -0700 Subject: [PATCH] pr45241 give up dot_prod pattern searching if stmt is outside the loop. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Give up dot_prod pattern searching if a stmt is outside the loop. * gcc.dg/vect/no-tree-pre-pr45241.c: New. --- gcc/testsuite/gcc.dg/vect/no-tree-pre-pr45241.c | 20 ++++++++++++++++++++ gcc/tree-vect-patterns.c | 5 +++++ 2 files changed, 25 insertions(+), 0 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/no-tree-pre-pr45241.c diff --git a/gcc/testsuite/gcc.dg/vect/no-tree-pre-pr45241.c b/gcc/testsuite/gcc.dg/vect/no-tree-pre-pr45241.c new file mode 100644 index 0000000..7a4ad9d --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/no-tree-pre-pr45241.c @@ -0,0 +1,20 @@ +/* PR tree-optimization/45241 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -fno-tree-pre" } */ + +int +foo (short x) +{ + short i, y; + int sum; + + for (i = 0; i < x; i++) + y = x * i; + + for (i = x; i > 0; i--) + sum += y; + + return sum; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 19f0ae6..19df13f 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -255,6 +255,11 @@ vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out) prod_type = half_type; stmt = SSA_NAME_DEF_STMT (oprnd0); + + /* It could not be the dot_prod pattern if the stmt is outside the loop. */ + if (!flow_bb_inside_loop_p (loop, gimple_bb (stmt))) + return NULL; + /* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi inside the loop (in case we are analyzing an outer-loop). */ if (!is_gimple_assign (stmt)) -- 1.6.3.3