From patchwork Mon Dec 31 15:26:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 208865 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 2356D2C00AC for ; Tue, 1 Jan 2013 02:27:13 +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=1357572434; 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=x8wTkor878xcYYamDB6S 6WFF/dI=; b=QTfhdBwrtCjermvm4bLvibEzlkIrju06mQPHrwRGh4N6hwN6Pplq KUS0wct4AlrARocsaiVnOD+VXhlVQx7bBsQ/3AX6tXG4cIV2ARh3ePmIjsGhP/gZ pIYhcV3sfQ1qOO5W52GTceZ7vSU4R3SsyeP7OFQvfJOWYaPs6Fxy3eM= 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=nEx6llE+ugh6z8M6JLuhWBRttDEMT+SptlNOug+xMDsqZBkTOsSRExQIP8Q5o7 H/xMRw0FPkJHHkDRj+yLEBcDKWFiQlGl55QJ+9O4+Aysf3l0RnqZI9cSpubDiSBP 9wXCkNpqX5vMlKCJ1MBxWmFSGcxogizNS040hp8zR5eKI=; Received: (qmail 24988 invoked by alias); 31 Dec 2012 15:27:04 -0000 Received: (qmail 24943 invoked by uid 22791); 31 Dec 2012 15:27:02 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, 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; Mon, 31 Dec 2012 15:26:49 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBVFQnIx014373 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 31 Dec 2012 10:26:49 -0500 Received: from zalov.redhat.com (vpn1-6-162.ams2.redhat.com [10.36.6.162]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qBVFQlw2018352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 31 Dec 2012 10:26:48 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id qBVFQk3s029856; Mon, 31 Dec 2012 16:26:46 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id qBVFQjHM029855; Mon, 31 Dec 2012 16:26:45 +0100 Date: Mon, 31 Dec 2012 16:26:44 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix vectorizer ICE (PR tree-optimization/55831) Message-ID: <20121231152644.GK2315@tucnak.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! The following testcase ICEs because get_initial_def_for_induction inserts stmts before gsi_start_bb, which is wrong for basic blocks that start with labels, as then the labels are in the middle of a basic block. Ok for trunk? 2012-12-31 Jakub Jelinek PR tree-optimization/55831 * tree-vect-loop.c (get_initial_def_for_induction): Use gsi_after_labels instead of gsi_start_bb. * gcc.dg/pr55831.c: New test. Jakub --- gcc/tree-vect-loop.c.jj 2012-11-27 14:33:14.000000000 +0100 +++ gcc/tree-vect-loop.c 2012-12-31 15:10:02.211716876 +0100 @@ -3406,7 +3406,7 @@ get_initial_def_for_induction (gimple iv build1 (VIEW_CONVERT_EXPR, resvectype, induc_def), NULL_TREE); induc_def = make_ssa_name (gimple_assign_lhs (new_stmt), new_stmt); gimple_assign_set_lhs (new_stmt, induc_def); - si = gsi_start_bb (bb); + si = gsi_after_labels (bb); gsi_insert_before (&si, new_stmt, GSI_SAME_STMT); set_vinfo_for_stmt (new_stmt, new_stmt_vec_info (new_stmt, loop_vinfo, NULL)); --- gcc/testsuite/gcc.dg/pr55831.c.jj 2012-12-31 15:25:11.484514159 +0100 +++ gcc/testsuite/gcc.dg/pr55831.c 2012-12-31 15:13:35.000000000 +0100 @@ -0,0 +1,22 @@ +/* PR tree-optimization/55831 */ +/* { dg-do compile } */ +/* { dg-options "-O -fstrict-overflow -ftree-vectorize -Wno-unused-label" } */ + +int g; +short p, q; + +void +f (void) +{ + short a = p, b = q, i; + + if (a) + { + label: + for (i = 0; i < 8; i++) + b ^= a++; + + if (!b) + g = 0; + } +}