From patchwork Mon Oct 24 09:17:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Rosen X-Patchwork-Id: 4792 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 71D3E23E51 for ; Mon, 24 Oct 2011 09:17:15 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 5AF7AA18728 for ; Mon, 24 Oct 2011 09:17:15 +0000 (UTC) Received: by bkbzs2 with SMTP id zs2so10931845bkb.11 for ; Mon, 24 Oct 2011 02:17:15 -0700 (PDT) Received: by 10.223.17.3 with SMTP id q3mr42342190faa.28.1319447834968; Mon, 24 Oct 2011 02:17:14 -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.152.1.71 with SMTP id 7cs57324lak; Mon, 24 Oct 2011 02:17:14 -0700 (PDT) Received: by 10.236.190.130 with SMTP id e2mr32255635yhn.107.1319447833566; Mon, 24 Oct 2011 02:17:13 -0700 (PDT) Received: from mail-iy0-f178.google.com (mail-iy0-f178.google.com [209.85.210.178]) by mx.google.com with ESMTPS id h63si16514690yhe.90.2011.10.24.02.17.12 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Oct 2011 02:17:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of ira.rosen@linaro.org) client-ip=209.85.210.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.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 iaqq3 with SMTP id q3so9408888iaq.37 for ; Mon, 24 Oct 2011 02:17:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.1.229 with SMTP id 5mr2822290pbp.88.1319447832195; Mon, 24 Oct 2011 02:17:12 -0700 (PDT) Received: by 10.142.63.7 with HTTP; Mon, 24 Oct 2011 02:17:12 -0700 (PDT) Date: Mon, 24 Oct 2011 11:17:12 +0200 Message-ID: Subject: [patch] Partial SLP - PR 50730 From: Ira Rosen To: gcc-patches@gcc.gnu.org Cc: Patch Tracking Hi, With this patch we are able to stop basic block analysis in case of unsupported data-ref and still vectorize the first part of the basic block. Bootstrapped and tested on powerpc64-suse-linux. Committed. Ira ChangeLog: PR tree-optimization/50730 * tree-vect-data-refs.c (vect_analyze_data_refs): Stop basic block analysis if encountered unsupported data-ref. testsuite/ChangeLog: PR tree-optimization/50730 * gcc.dg/vect/no-tree-sra-bb-slp-pr50730.c: New test. * gcc.dg/vect/vect.exp: Run no-tree-sra-bb-slp* tests with -fno-tree-sra and SLP flags. Index: tree-vect-data-refs.c =================================================================== --- tree-vect-data-refs.c (revision 180364) +++ tree-vect-data-refs.c (working copy) @@ -2524,7 +2524,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, VEC (data_reference_p, heap) *datarefs; struct data_reference *dr; tree scalar_type; - bool res; + bool res, stop_bb_analysis = false; if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "=== vect_analyze_data_refs ===\n"); @@ -2579,12 +2579,19 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, { if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) fprintf (vect_dump, "not vectorized: unhandled data-ref "); + return false; } stmt = DR_STMT (dr); stmt_info = vinfo_for_stmt (stmt); + if (stop_bb_analysis) + { + STMT_VINFO_VECTORIZABLE (stmt_info) = false; + continue; + } + /* Check that analysis of the data-ref succeeded. */ if (!DR_BASE_ADDRESS (dr) || !DR_OFFSET (dr) || !DR_INIT (dr) || !DR_STEP (dr)) @@ -2595,6 +2602,13 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); } + if (bb_vinfo) + { + STMT_VINFO_VECTORIZABLE (stmt_info) = false; + stop_bb_analysis = true; + continue; + } + return false; } @@ -2603,7 +2617,15 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) fprintf (vect_dump, "not vectorized: base addr of dr is a " "constant"); - return false; + + if (bb_vinfo) + { + STMT_VINFO_VECTORIZABLE (stmt_info) = false; + stop_bb_analysis = true; + continue; + } + + return false; } if (TREE_THIS_VOLATILE (DR_REF (dr))) @@ -2613,6 +2635,14 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, fprintf (vect_dump, "not vectorized: volatile type "); print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); } + + if (bb_vinfo) + { + STMT_VINFO_VECTORIZABLE (stmt_info) = false; + stop_bb_analysis = true; + continue; + } + return false; } @@ -2628,6 +2658,14 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, "exception "); print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); } + + if (bb_vinfo) + { + STMT_VINFO_VECTORIZABLE (stmt_info) = false; + stop_bb_analysis = true; + continue; + } + return false; } @@ -2745,6 +2783,14 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, "not vectorized: more than one data ref in stmt: "); print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); } + + if (bb_vinfo) + { + STMT_VINFO_VECTORIZABLE (stmt_info) = false; + stop_bb_analysis = true; + continue; + } + return false; } @@ -2769,6 +2815,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, { /* Mark the statement as not vectorizable. */ STMT_VINFO_VECTORIZABLE (stmt_info) = false; + stop_bb_analysis = true; continue; } else Index: testsuite/gcc.dg/vect/no-tree-sra-bb-slp-pr50730.c =================================================================== --- testsuite/gcc.dg/vect/no-tree-sra-bb-slp-pr50730.c (revision 0) +++ testsuite/gcc.dg/vect/no-tree-sra-bb-slp-pr50730.c (revision 0) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_float } */ + +typedef __complex__ float Value; +typedef struct { + Value a[16 / sizeof (Value)]; +} A; + +A sum(A a,A b) +{ + a.a[0]+=b.a[0]; + a.a[1]+=b.a[1]; + return a; +} + +/* { dg-final { scan-tree-dump-times "not vectorized: more than one data ref in stmt" 0 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ Index: testsuite/gcc.dg/vect/vect.exp =================================================================== --- testsuite/gcc.dg/vect/vect.exp (revision 180364) +++ testsuite/gcc.dg/vect/vect.exp (working copy) @@ -269,6 +269,13 @@ lappend DEFAULT_VECTCFLAGS "-fno-tree-fre" "-fno-t dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-fre-pre*.\[cS\]]] \ "" $DEFAULT_VECTCFLAGS +# -fno-tree-sra +set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS +lappend VECT_SLP_CFLAGS "-fno-tree-sra" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-sra-bb-slp-*.\[cS\]]] \ + "" $VECT_SLP_CFLAGS + + # Clean up. set dg-do-what-default ${save-dg-do-what-default}