From patchwork Sun Jul 3 10:15:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Rosen X-Patchwork-Id: 2431 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 5B2B324127 for ; Sun, 3 Jul 2011 10:15:21 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id 1F1B7A184B2 for ; Sun, 3 Jul 2011 10:15:21 +0000 (UTC) Received: by qwb8 with SMTP id 8so3068370qwb.11 for ; Sun, 03 Jul 2011 03:15:20 -0700 (PDT) Received: by 10.229.54.12 with SMTP id o12mr249670qcg.80.1309688120327; Sun, 03 Jul 2011 03:15:20 -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.48.135 with SMTP id r7cs5551qcf; Sun, 3 Jul 2011 03:15:19 -0700 (PDT) Received: by 10.68.10.98 with SMTP id h2mr6220528pbb.372.1309688118728; Sun, 03 Jul 2011 03:15:18 -0700 (PDT) Received: from mail-pv0-f178.google.com (mail-pv0-f178.google.com [74.125.83.178]) by mx.google.com with ESMTPS id n9si26750929wfe.72.2011.07.03.03.15.18 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 03 Jul 2011 03:15:18 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.178 is neither permitted nor denied by best guess record for domain of ira.rosen@linaro.org) client-ip=74.125.83.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.83.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 pvg7 with SMTP id 7so4894019pvg.37 for ; Sun, 03 Jul 2011 03:15:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.191.20 with SMTP id o20mr459275wff.274.1309688117919; Sun, 03 Jul 2011 03:15:17 -0700 (PDT) Received: by 10.143.82.4 with HTTP; Sun, 3 Jul 2011 03:15:17 -0700 (PDT) Date: Sun, 3 Jul 2011 13:15:17 +0300 Message-ID: Subject: [patch] Fix PR tree-optimization/49610 From: Ira Rosen To: gcc-patches@gcc.gnu.org Cc: Patch Tracking Hi, This patch adds a missing check that a basic blocks exists before using it. Bootstrapped and tested on powerpc64-suse-linux. Committed. Ira ChangeLog: PR tree-optimization/49610 * tree-vect-loop.c (vect_is_slp_reduction): Check that DEF_STMT has a basic block. testsuite/ChangeLog: PR tree-optimization/49610 * gcc.dg/vect/pr49610.c: New test. Index: testsuite/gcc.dg/vect/pr49610.c =================================================================== --- testsuite/gcc.dg/vect/pr49610.c (revision 0) +++ testsuite/gcc.dg/vect/pr49610.c (revision 0) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ + +extern int g_7; +void func_13(int p_17) { + int i; + for (i=0; i < 16; i = (signed char)(i+1)) { + g_7 &= p_17; + g_7 &= (p_17 > 1); + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ Index: tree-vect-loop.c =================================================================== --- tree-vect-loop.c (revision 175785) +++ tree-vect-loop.c (working copy) @@ -1823,6 +1823,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gi ("vect_internal_def"), or it's an induction (defined by a loop-header phi-node). */ if (def_stmt + && gimple_bb (def_stmt) && flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) && (is_gimple_assign (def_stmt) || is_gimple_call (def_stmt) @@ -1852,6 +1853,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gi ("vect_internal_def"), or it's an induction (defined by a loop-header phi-node). */ if (def_stmt + && gimple_bb (def_stmt) && flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) && (is_gimple_assign (def_stmt) || is_gimple_call (def_stmt)