From patchwork Wed Feb 1 16:40:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 138955 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 52714B6EF1 for ; Thu, 2 Feb 2012 03:40:46 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1328719247; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=kfeeAI5tOqMARxjW01oG /6BZOUQ=; b=Ixq7oUNB1ohhpXE3/EYPfxmJFE4Rr/JUrLKO3Qj1Zo6+qfF8G89e dGkewHpO7P0VrRnvhcEjpAXKOuJ7OEymI+LFWwmv5Q+NPByRavym/v33DTMdmSt7 33o9IX+ubGvWzExKA3AQcB5rCi+RGQkJdcaew5NSpLiw8o7e2T9K1io= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=fGz3XTJqUoehpHqhsCIPgFkPmAkxFy1nfIWtP6ojjjRo63oq4VeDgjCHCpr8sh i7ySUhGC4VotUzgizF4d5nGgUxYIhoRpA2BUaCkXCkvj5YSFeCTlW+yUqKE7Gqsw 6OEp74BnAhvyvA/N4ZKLqNsF1/ykg7jmvtt0WTkMyD/I0=; Received: (qmail 26139 invoked by alias); 1 Feb 2012 16:40:35 -0000 Received: (qmail 26022 invoked by uid 22791); 1 Feb 2012 16:40:33 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Feb 2012 16:40:18 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q11GeHsh028620 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 1 Feb 2012 11:40:17 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q11GeGb3005910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 1 Feb 2012 11:40:16 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id q11GeETs030435; Wed, 1 Feb 2012 17:40:14 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id q11GeDDX030434; Wed, 1 Feb 2012 17:40:13 +0100 Date: Wed, 1 Feb 2012 17:40:13 +0100 From: Jakub Jelinek To: Richard Guenther , Ira Rosen Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Don't ICE in vectorizer when testing if a pattern stmt is used by another pattern stmt (PR tree-optimization/52073) Message-ID: <20120201164013.GS18768@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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! vinfo_for_stmt can't be used on stmts outside of the current loop. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-02-01 Jakub Jelinek PR tree-optimization/52073 * tree-vect-stmts.c (vect_mark_relevant): When checking uses of a pattern stmt for pattern uses, ignore uses outside of the loop. * gcc.c-torture/compile/pr52073.c: New test. Jakub --- gcc/tree-vect-stmts.c.jj 2012-01-22 16:02:10.000000000 +0100 +++ gcc/tree-vect-stmts.c 2012-02-01 10:33:58.847815421 +0100 @@ -150,6 +150,8 @@ vect_mark_relevant (VEC(gimple,heap) **w use_operand_p use_p; gimple use_stmt; tree lhs; + loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); + struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); if (is_gimple_assign (stmt)) lhs = gimple_assign_lhs (stmt); @@ -166,6 +168,9 @@ vect_mark_relevant (VEC(gimple,heap) **w continue; use_stmt = USE_STMT (use_p); + if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) + continue; + if (vinfo_for_stmt (use_stmt) && STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (use_stmt))) { --- gcc/testsuite/gcc.c-torture/compile/pr52073.c.jj 2012-02-01 10:39:13.041003562 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr52073.c 2012-02-01 10:38:51.000000000 +0100 @@ -0,0 +1,28 @@ +/* PR tree-optimization/52073 */ + +int a, b, c, d, e, f; + +void +foo (int x) +{ + e = 1; + for (;;) + { + int g = c; + if (x) + { + if (e) + continue; + while (a) + --f; + } + else + for (b = 5; b; b--) + { + d = g; + g = 0 == d; + } + if (!g) + x = 0; + } +}