From patchwork Thu Aug 11 05:43:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Rosen X-Patchwork-Id: 3391 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id F0F1423F51 for ; Thu, 11 Aug 2011 05:43:44 +0000 (UTC) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.216.173]) by fiordland.canonical.com (Postfix) with ESMTP id B7E8BA18636 for ; Thu, 11 Aug 2011 05:43:44 +0000 (UTC) Received: by qyk31 with SMTP id 31so3778288qyk.11 for ; Wed, 10 Aug 2011 22:43:44 -0700 (PDT) Received: by 10.229.63.14 with SMTP id z14mr209285qch.83.1313041424084; Wed, 10 Aug 2011 22:43:44 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.190.71 with SMTP id dh7cs103045qcb; Wed, 10 Aug 2011 22:43:43 -0700 (PDT) Received: from mr.google.com ([10.150.75.15]) by 10.150.75.15 with SMTP id x15mr292337yba.75.1313041423510 (num_hops = 1); Wed, 10 Aug 2011 22:43:43 -0700 (PDT) Received: by 10.150.75.15 with SMTP id x15mr208150yba.75.1313041422663; Wed, 10 Aug 2011 22:43:42 -0700 (PDT) Received: from mail-gy0-f178.google.com (mail-gy0-f178.google.com [209.85.160.178]) by mx.google.com with ESMTPS id h21si4206699yba.18.2011.08.10.22.43.42 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 10 Aug 2011 22:43:42 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of ira.rosen@linaro.org) client-ip=209.85.160.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of ira.rosen@linaro.org) smtp.mail=ira.rosen@linaro.org Received: by gyh3 with SMTP id 3so1251876gyh.37 for ; Wed, 10 Aug 2011 22:43:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.101.176.26 with SMTP id d26mr8173446anp.65.1313041422158; Wed, 10 Aug 2011 22:43:42 -0700 (PDT) Received: by 10.100.191.10 with HTTP; Wed, 10 Aug 2011 22:43:42 -0700 (PDT) Date: Thu, 11 Aug 2011 08:43:42 +0300 Message-ID: Subject: [patch] Fix PR tree-optimization/50039 From: Ira Rosen To: gcc-patches@gcc.gnu.org Cc: Patch Tracking Hi, This patch adds a check in vect_operation_fits_smaller_type () that a widening statement has a stmt_vec_info, i.e., that it is a loop statement. Bootstrapped and tested on powerpc64-suse-linux. Committed. Ira ChangeLog: PR tree-optimization/50039 * tree-vect-patterns.c (vect_operation_fits_smaller_type): Check that DEF_STMT has a stmt_vec_info. testsuite/ChangeLog: PR tree-optimization/50039 * gcc.dg/vect/vect.exp: Run no-tree-fre-* tests with -fno-tree-fre. * gcc.dg/vect/no-tree-fre-pr50039.c: New test. Index: testsuite/gcc.dg/vect/vect.exp =================================================================== --- testsuite/gcc.dg/vect/vect.exp (revision 177646) +++ testsuite/gcc.dg/vect/vect.exp (working copy) @@ -257,6 +257,12 @@ lappend VECT_SLP_CFLAGS "-fno-tree-reassoc" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \ "" $VECT_SLP_CFLAGS +# -fno-tree-fre +set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS +lappend DEFAULT_VECTCFLAGS "-fno-tree-fre" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-fre-*.\[cS\]]] \ + "" $DEFAULT_VECTCFLAGS + # Clean up. set dg-do-what-default ${save-dg-do-what-default} Index: testsuite/gcc.dg/vect/no-tree-fre-pr50039.c =================================================================== --- testsuite/gcc.dg/vect/no-tree-fre-pr50039.c (revision 0) +++ testsuite/gcc.dg/vect/no-tree-fre-pr50039.c (revision 0) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +extern unsigned char g_5; +extern int g_31, g_76; +int main(void) { + int i, j; + for (j=0; j < 2; ++j) { + g_31 = -3; + for (i=0; i < 2; ++i) + g_76 = (g_31 ? g_31+1 : 0) ^ g_5; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ + Index: tree-vect-patterns.c =================================================================== --- tree-vect-patterns.c (revision 177646) +++ tree-vect-patterns.c (working copy) @@ -897,7 +897,8 @@ vect_operation_fits_smaller_type (gimple stmt, tre else { first = true; - if (!widened_name_p (oprnd, stmt, &half_type, &def_stmt, false)) + if (!widened_name_p (oprnd, stmt, &half_type, &def_stmt, false) + || !vinfo_for_stmt (def_stmt)) return false; }