From patchwork Mon Jan 18 12:58:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 569537 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 7135A1401AD for ; Mon, 18 Jan 2016 23:59:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=fpaemYyC; 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=XSPpYkIv5VZx4zHOl IGL2eixOcNp3QIjGZKNwzGJ/WKpDyC72ETQcxupWX5axJG8jmbnvfnwFb4kCG5Bt 1gRx5iuq1vqrwe/BZ3dR6pLxsDMmMVEuWKwyuc7YXGE8s9ZQgwK63ozEfz3bh6QJ VpkUwctwDDWGI+gBQxLLwszXXs= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=xzaByDNsX2BvYkl02TI2vsr jWb8=; b=fpaemYyCwnm6apt48KdoHcqTEelddKqVrz/xL2f3xz52tt+HVJGC4JZ 0h5lrU24aa7WAdGTDFqMecNNE4cXchccbSOskW4qj47qUD+IzmFHMeOiMmFZurBj rfciLpsrB0CTfuvnEzU6hGkO52ZlxM57zDLTu835BrH8bMS3vjms= Received: (qmail 14945 invoked by alias); 18 Jan 2016 12:59:43 -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 14932 invoked by uid 89); 18 Jan 2016 12:59:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1807, HX-detected-operating-system:Windows 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; Mon, 18 Jan 2016 12:59:41 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35042) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1aL9PH-0002K6-2k for gcc-patches@gnu.org; Mon, 18 Jan 2016 07:59:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aL9PC-0000rO-GL for gcc-patches@gnu.org; Mon, 18 Jan 2016 07:59:38 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:50663) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL9PC-0000pV-B9 for gcc-patches@gnu.org; Mon, 18 Jan 2016 07:59:34 -0500 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 1aL9Ov-0002UD-VI from Tom_deVries@mentor.com ; Mon, 18 Jan 2016 04:59:18 -0800 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; Mon, 18 Jan 2016 12:58:29 +0000 Subject: [Committed] Allow pass_parallelize_loops to be run outside the loop pipeline To: Richard Biener References: <5640BD31.2060602@mentor.com> <5640F98B.5050601@mentor.com> <5649C508.80803@mentor.com> <5654570F.3050003@mentor.com> <566DA3BF.7040105@mentor.com> CC: "gcc-patches@gnu.org" , Jakub Jelinek , Richard Biener From: Tom de Vries Message-ID: <569CE16C.8030206@mentor.com> Date: Mon, 18 Jan 2016 13:58:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 [ was: Re: [PIING][PATCH, 9/16] Add pass_parallelize_loops_oacc_kernels ] On 14/12/15 16:22, Richard Biener wrote: > Can the pass not just use a pass parameter to switch between oacc/non-oacc? It can, and that means that parloops is run outside the loops pipeline. This patch enables that. Bootstrapped and reg-tested on x86_64. Committed to trunk. Thanks, - Tom Allow pass_parallelize_loops to be run outside the loop pipeline 2016-01-18 Tom de Vries * tree-parloops.c (pass_parallelize_loops::execute): Allow pass_parallelize_loops to be run outside the loop pipeline. --- gcc/tree-parloops.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 46d70ac..885103e 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2844,23 +2844,41 @@ public: unsigned pass_parallelize_loops::execute (function *fun) { - if (number_of_loops (fun) <= 1) - return 0; - tree nthreads = builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_THREADS); if (nthreads == NULL_TREE) return 0; + bool in_loop_pipeline = scev_initialized_p (); + if (!in_loop_pipeline) + loop_optimizer_init (LOOPS_NORMAL + | LOOPS_HAVE_RECORDED_EXITS); + + if (number_of_loops (fun) <= 1) + return 0; + + if (!in_loop_pipeline) + { + rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa); + scev_initialize (); + } + + unsigned int todo = 0; if (parallelize_loops ()) { fun->curr_properties &= ~(PROP_gimple_eomp); checking_verify_loop_structure (); - return TODO_update_ssa; + todo |= TODO_update_ssa; + } + + if (!in_loop_pipeline) + { + scev_finalize (); + loop_optimizer_finalize (); } - return 0; + return todo; } } // anon namespace