From patchwork Wed Oct 14 14:53:23 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: 530220 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 5462A140213 for ; Thu, 15 Oct 2015 01:54:54 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=jEJpFIoI; 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=XUM/9XfztmIF057bU qFMXbrxjgAv5BUoa13Ig/1JHQta0ABitQPFSaC3+kJMbrVh8yVvJdCG6vbY3SUDD q0O8bl8bWWL3Hvxa/6heItY84tMZ2Vpe4ohjao982OIR+R586ISNTKBIRXqUx5HD BDgwrXCnWGQyn8p/AOjjjwhEho= 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=svVaZGluZm8z3w+oMOBgOQQ GuKs=; b=jEJpFIoINGmXkgv2xXsGi71hHy6f9vOJ50eB3et3o1I4IApvLGpY60k JH4RiVErXpN2BAtdT43gk7hGrQVSPHzhXtPNql+mA8lOt53562mB8h4r8IkPfyGv 8d6/QrMtfgPiuxmDOdZySXC+lX1aAw77vGI7205s3j/GiNGX73m0= Received: (qmail 105847 invoked by alias); 14 Oct 2015 14:54:47 -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 105830 invoked by uid 89); 14 Oct 2015 14:54:46 -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, SPF_PASS, T_RP_MATCHES_RCVD 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; Wed, 14 Oct 2015 14:54:44 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51545) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZmNRx-0001Kg-KS for gcc-patches@gnu.org; Wed, 14 Oct 2015 10:54:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmNRs-0005ID-3V for gcc-patches@gnu.org; Wed, 14 Oct 2015 10:54:41 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:50256) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmNRr-0005Hh-TE for gcc-patches@gnu.org; Wed, 14 Oct 2015 10:54:36 -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 1ZmNRq-0001eo-Mn from Tom_deVries@mentor.com for gcc-patches@gnu.org; Wed, 14 Oct 2015 07:54:34 -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; Wed, 14 Oct 2015 15:54:13 +0100 Subject: [gomp4, committed] Backported param parloops-schedule To: Thomas Schwinge References: <560100FF.9060904@mentor.com> <5601343C.9010104@redhat.com> <56114774.9090108@mentor.com> <561394CA.1050504@redhat.com> <5618F121.4070100@mentor.com> <5618FD7E.6060505@mentor.com> <561BBF8D.7040602@redhat.com> <561BE63D.2030907@mentor.com> <87si5el9s9.fsf@kepler.schwinge.homeip.net> CC: "gcc-patches@gnu.org" , Chung-Lin Tang From: Tom de Vries Message-ID: <561E6C63.6060809@mentor.com> Date: Wed, 14 Oct 2015 16:53:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <87si5el9s9.fsf@kepler.schwinge.homeip.net> X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 [ was: Re: [PATCH, 3/5] Handle original loop tree in expand_omp_for_generic ] On 13/10/15 23:48, Thomas Schwinge wrote: > Hi Tom! > > On Mon, 12 Oct 2015 18:56:29 +0200, Tom de Vries wrote: >> >Handle original loop tree in expand_omp_for_generic >> > >> >2015-09-12 Tom de Vries >> > >> > PR tree-optimization/67476 >> > * omp-low.c (expand_omp_for_generic): Handle original loop tree. > Working on a merge from trunk into gomp-4_0-branch, I'm seeing your > change (trunk r228754) conflict with code Chung-Lin changed > (gomp-4_0-branch r224505). So, would you two please cherry-pick/merge > trunk r228754 into gomp-4_0-branch? Thanks! (I'm assuming you can > easily tell what needs to be done here; it's been a long time that > Chung-Lin touched this code, so CCing him just in case.) Thanks! Hi Thomas, I've backport the whole patch series: 1 Handle simple latch in expand_omp_for_generic 2 Add missing phis in expand_omp_for_generic 3 Handle original loop tree in expand_omp_for_generic 4 Support DEFPARAMENUM in params.def 5 Add param parloops-schedule and committed to gomp-4_0-branch. I'm only posting patch nr. 3, the only one with a non-trivial conflict. Thanks, - Tom Handle original loop tree in expand_omp_for_generic 2015-10-14 Tom de Vries backport from trunk: 2015-10-13 Tom de Vries PR tree-optimization/67476 * omp-low.c (expand_omp_for_generic): Handle original loop tree. --- gcc/omp-low.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 473e2e7..dde3e1b 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -6924,7 +6924,6 @@ expand_omp_for_generic (struct omp_region *region, remove_edge (e); make_edge (cont_bb, l2_bb, EDGE_FALSE_VALUE); - add_bb_to_loop (l2_bb, cont_bb->loop_father); e = find_edge (cont_bb, l1_bb); if (e == NULL) { @@ -7002,23 +7001,36 @@ expand_omp_for_generic (struct omp_region *region, set_immediate_dominator (CDI_DOMINATORS, l1_bb, recompute_dominator (CDI_DOMINATORS, l1_bb)); - struct loop *outer_loop; - if (seq_loop) - outer_loop = l0_bb->loop_father; - else + /* We enter expand_omp_for_generic with a loop. This original loop may + have its own loop struct, or it may be part of an outer loop struct + (which may be the fake loop). */ + struct loop *outer_loop = entry_bb->loop_father; + bool orig_loop_has_loop_struct = l1_bb->loop_father != outer_loop; + + add_bb_to_loop (l2_bb, outer_loop); + + struct loop *new_loop = NULL; + if (!seq_loop) { - outer_loop = alloc_loop (); - outer_loop->header = l0_bb; - outer_loop->latch = l2_bb; - add_loop (outer_loop, l0_bb->loop_father); + /* We've added a new loop around the original loop. Allocate the + corresponding loop struct. */ + new_loop = alloc_loop (); + new_loop->header = l0_bb; + new_loop->latch = l2_bb; + add_loop (new_loop, outer_loop); } - if (!gimple_omp_for_combined_p (fd->for_stmt)) + /* Allocate a loop structure for the original loop unless we already + had one. */ + if (!orig_loop_has_loop_struct + && !gimple_omp_for_combined_p (fd->for_stmt)) { - struct loop *loop = alloc_loop (); - loop->header = l1_bb; + struct loop *orig_loop = alloc_loop (); + orig_loop->header = l1_bb; /* The loop may have multiple latches. */ - add_loop (loop, outer_loop); + add_loop (orig_loop, (new_loop != NULL + ? new_loop + : outer_loop)); } } } -- 1.9.1