From patchwork Fri Jul 24 15:05:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 499778 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D29701402B7 for ; Sat, 25 Jul 2015 01:05:43 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=YwHvrM+A; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=OkC3XMHvPXS2q+Asprk9A0UoPSpDOsxxfVt4nUjkDMyTSS Icmg6M5axcRJoH1c2PXJe+yP2wDcIePTeaI3Ev0ALRtYXkOSOz4J8rlk5J7kgXgz wLhYHqNhY31xsRe1Y+/U6I5QLUXFojU23FYKjtVZB51JJ4k/cMKAwYmeN13tg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=1XV1dzcodv6o7iGfbzBj+wZzyvU=; b=YwHvrM+APjdexxEURG7f 0244jCk1z42WvGB8AkXX1OlLginm3lyuZ253dV3T/kNheCjRnD5BrtaU3WSOPcmR 9WCzF3PUWcMb+tP+bv5xJU7aD099x9SS2XDLfXydaoDgxkmKUhHi5FUaZQbnD+eJ uABtTIjLPGr0Fkg1YZHL808= Received: (qmail 60288 invoked by alias); 24 Jul 2015 15:05:36 -0000 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 Received: (qmail 60278 invoked by uid 89); 24 Jul 2015 15:05:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 24 Jul 2015 15:05:34 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43661) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZIeXT-0003ei-SO for gcc-patches@gnu.org; Fri, 24 Jul 2015 11:05:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIeXO-0000p2-23 for gcc-patches@gnu.org; Fri, 24 Jul 2015 11:05:31 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:34454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIeXN-0000ot-Od for gcc-patches@gnu.org; Fri, 24 Jul 2015 11:05:25 -0400 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZIeXM-0005Im-2C from Tom_deVries@mentor.com for gcc-patches@gnu.org; Fri, 24 Jul 2015 08:05:24 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Fri, 24 Jul 2015 16:05:22 +0100 Message-ID: <55B25424.2080704@mentor.com> Date: Fri, 24 Jul 2015 17:05:08 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "gcc-patches@gnu.org" Subject: [committed] Add transform_to_exit_first_loop_alt dump success message X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 Hi, this patch adds a message to the parloops dump file when transform_to_exit_first_loop_alt is successful. In the relevant testcases, we scan for this message, instead of for code patterns, making the tests more stable. Committed as trivial. Thanks, - Tom Add transform_to_exit_first_loop_alt dump success message 2015-07-24 Tom de Vries * tree-parloops.c (gen_parallel_loop): Add debug print for alternative exit-first loop transform. * gcc.dg/parloops-exit-first-loop-alt-2.c: Use debug print for alternative exit-first loop transform. * gcc.dg/parloops-exit-first-loop-alt-3.c: Same. * gcc.dg/parloops-exit-first-loop-alt-4.c: Same. * gcc.dg/parloops-exit-first-loop-alt-5.c: Same. * gcc.dg/parloops-exit-first-loop-alt-6.c: Same. * gcc.dg/parloops-exit-first-loop-alt-7.c: Same. * gcc.dg/parloops-exit-first-loop-alt-pr66652.c: Same. * gcc.dg/parloops-exit-first-loop-alt.c: Same. * gfortran.dg/parloops-exit-first-loop-alt-2.f95: Same. * gfortran.dg/parloops-exit-first-loop-alt.f95: Same. --- gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-2.c | 9 ++------- gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-3.c | 9 ++------- gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-4.c | 9 ++------- gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-5.c | 9 ++------- gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-6.c | 9 ++------- gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-7.c | 9 ++------- gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-pr66652.c | 11 +++-------- gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt.c | 10 +++------- gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt-2.f95 | 9 ++------- gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt.f95 | 10 +++------- gcc/tree-parloops.c | 10 +++++++++- 11 files changed, 32 insertions(+), 72 deletions(-) diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-2.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-2.c index 24e605a..f1cf75f 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-2.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Constant bound, vector addition. */ @@ -19,9 +19,4 @@ f (void) c[i] = a[i] + b[i]; } -/* Three times three array accesses: - - three in f._loopfn.0 - - three in the parallel - - three in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)\\\[i" 9 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-3.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-3.c index fec53a1..c7154ba 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-3.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-3.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Variable bound, reduction. */ @@ -18,9 +18,4 @@ f (unsigned int n, unsigned int *__restrict__ a) return sum; } -/* Three array accesses: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)\\\* 4" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-4.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-4.c index 2b8d289..5f7fe68 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-4.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-4.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Constant bound, reduction. */ @@ -20,9 +20,4 @@ f (void) return sum; } -/* Three array accesses: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)\\\* 4" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-5.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-5.c index 3f799cf..3c1e99b 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-5.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-5.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Variable bound, vector addition, unsigned loop counter, unsigned bound. */ @@ -14,9 +14,4 @@ f (unsigned int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, c[i] = a[i] + b[i]; } -/* Three times a store: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)^ \\*_\[0-9\]*" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-6.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-6.c index ee19a55..edc60ba 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-6.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-6.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Variable bound, vector addition, unsigned loop counter, signed bound. */ @@ -14,9 +14,4 @@ f (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, c[i] = a[i] + b[i]; } -/* Three times a store: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)^ \\*_\[0-9\]*" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-7.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-7.c index c337342..38be2e8 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-7.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-7.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Variable bound, vector addition, signed loop counter, signed bound. */ @@ -14,9 +14,4 @@ f (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, c[i] = a[i] + b[i]; } -/* Three times a store: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)^ \\*_\[0-9\]*" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-pr66652.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-pr66652.c index 2ea097d..6f3ece5 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-pr66652.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-pr66652.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ #include #include @@ -22,10 +22,5 @@ f (unsigned int n, unsigned int sum) return sum; } -/* Four times % 13: - - once in f._loopfn.0 - - once in the parallel - - once in the low iteration count loop - - once for a peeled off last iteration following the parallel. - In other words, we want try_transform_to_exit_first_loop_alt to fail. */ -/* { dg-final { scan-tree-dump-times "(?n)% 13" 4 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "parallelizing inner loop" 1 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 0 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt.c index 0b69165..44596e3 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Variable bound, vector addition, signed loop counter, unsigned bound. */ @@ -14,9 +14,5 @@ f (unsigned int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, c[i] = a[i] + b[i]; } -/* Three times a store: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)^ \\*_\[0-9\]*" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ + diff --git a/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt-2.f95 b/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt-2.f95 index f26a6e3..52434f2 100644 --- a/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt-2.f95 +++ b/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt-2.f95 @@ -1,7 +1,7 @@ ! { dg-additional-options "-O2" } ! { dg-require-effective-target pthread } ! { dg-additional-options "-ftree-parallelize-loops=2" } -! { dg-additional-options "-fdump-tree-parloops" } +! { dg-additional-options "-fdump-tree-parloops-details" } ! Constant bound, vector addition. @@ -16,9 +16,4 @@ subroutine foo () end do end subroutine foo -! Three times plus 25: -! - once in f._loopfn.0 -! - once in the parallel -! - once in the low iteration count loop -! Crucially, none for a peeled off last iteration following the parallel. -! { dg-final { scan-tree-dump-times "(?n) \\+ 25;" 3 "parloops" } } +! { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } diff --git a/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt.f95 b/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt.f95 index 6dc8a38..1eb9dfd 100644 --- a/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt.f95 +++ b/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt.f95 @@ -1,7 +1,7 @@ ! { dg-additional-options "-O2" } ! { dg-require-effective-target pthread } ! { dg-additional-options "-ftree-parallelize-loops=2" } -! { dg-additional-options "-fdump-tree-parloops" } +! { dg-additional-options "-fdump-tree-parloops-details" } ! Variable bound, vector addition. @@ -17,9 +17,5 @@ subroutine foo (nr) end do end subroutine foo -! Three times plus 25: -! - once in f._loopfn.0 -! - once in the parallel -! - once in the low iteration count loop -! Crucially, none for a peeled off last iteration following the parallel. -! { dg-final { scan-tree-dump-times "(?n) \\+ 25;" 3 "parloops" } } +! { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } + diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 88f22e8..6e75cb1 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2246,7 +2246,15 @@ gen_parallel_loop (struct loop *loop, increment) and immediately follows the loop exit test. Attempt to move the entry of the loop directly before the exit check and increase the number of iterations of the loop by one. */ - if (!try_transform_to_exit_first_loop_alt (loop, reduction_list, nit)) + if (try_transform_to_exit_first_loop_alt (loop, reduction_list, nit)) + { + if (dump_file + && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, + "alternative exit-first loop transform succeeded" + " for loop %d\n", loop->num); + } + else { /* Fall back on the method that handles more cases, but duplicates the loop body: move the exit condition of LOOP to the beginning of its -- 1.9.1