From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19744 invoked by alias); 31 Aug 2015 11:51:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 19727 invoked by uid 89); 31 Aug 2015 11:50:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 31 Aug 2015 11:50:58 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZWNbz-0003wn-7u from Tom_deVries@mentor.com ; Mon, 31 Aug 2015 04:50:55 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Mon, 31 Aug 2015 12:50:51 +0100 Message-ID: <55E43F92.6060105@mentor.com> Date: Mon, 31 Aug 2015 11:55:00 -0000 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Jakub Jelinek CC: GCC Patches Subject: [PATCH][2/5] Handle simple latch bb in expand_omp_for_static_chunk References: <552E6341.4040401@mentor.com> <55E43D5D.5020300@mentor.com> In-Reply-To: <55E43D5D.5020300@mentor.com> Content-Type: multipart/mixed; boundary="------------010703080802020601000705" X-SW-Source: 2015-08/txt/msg01871.txt.bz2 --------------010703080802020601000705 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 2044 On 31/08/15 13:41, Tom de Vries wrote: > On 15/04/15 15:10, Tom de Vries wrote: >> Hi, >> >> This patch series fixes PR65637. >> >> Currently, ssa-handling code in expand_omp_for_static_chunk is dead and >> not exercised by testing. >> >> Ssa-handling code in omp-low.c is only triggered by >> pass_parallelize_loops, and that pass doesn't specify a chunk size on >> the GIMPLE_OMP_FOR it constructs, so that only exercises the >> expand_omp_for_static_nochunk path. >> >> Using the attached trigger patch, we excercise the ssa-handling code in >> expand_omp_for_static_chunk. > > > > 1. Fix gcc_assert in expand_omp_for_static_chunk > > 2. Fix inner loop phi in expand_omp_for_static_chunk > > 3. Handle 2 preds for fin_bb in expand_omp_for_static_chunk > > I'm posting an updated series. > > 1. Add param parloops-chunk-size > 2. Handle simple latch bb in expand_omp_for_static_chunk > 3. Fix gcc_assert in expand_omp_for_static_chunk > 4. Fix inner loop phi in expand_omp_for_static_chunk > 5. Handle 2 preds for fin_bb in expand_omp_for_static_chunk > > There are two new patches, (1) and (2) in the new numbering. > > The first patch adds a param parloops-chunk-size, which means the > ssa-handling code in expand_omp_for_static_chunk is no longer dead. > > The second patch handles simple latches in expand_omp_for_static_chunk, > similar to the fix for PR66846 in expand_omp_for_static_nochunk. > > The rest of the patches are now updated to include the testcases (and > patch number 4 has been updated to handle simple latches). > > The patch series has been bootstrapped and reg-tested on x86_64. > > I'll post the patches from the patch series individually. The first two > in response to this email, the latter three in response to the earlier > submissions. > Hi, this patch handles simple latches in expand_omp_for_static_chunk, similar to how it's done for expand_omp_for_static_nochunk in the fix for PR66846 ( https://gcc.gnu.org/viewcvs/gcc/trunk/gcc/omp-low.c?annotate=226427&pathrev=226427#l6539 ). Thanks, - Tom --------------010703080802020601000705 Content-Type: text/x-patch; name="0002-Handle-simple-latch-bb-in-expand_omp_for_static_chun.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0002-Handle-simple-latch-bb-in-expand_omp_for_static_chun.pa"; filename*1="tch" Content-length: 2003 Handle simple latch bb in expand_omp_for_static_chunk 2015-08-31 Tom de Vries * omp-low.c (expand_omp_for_static_chunk): Handle simple latch bb. --- gcc/omp-low.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/gcc/omp-low.c b/gcc/omp-low.c index aa2a598..c3dfc51 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -6960,7 +6960,8 @@ expand_omp_for_static_chunk (struct omp_region *region, body_bb = single_succ (seq_start_bb); if (!broken_loop) { - gcc_assert (BRANCH_EDGE (cont_bb)->dest == body_bb); + gcc_assert (BRANCH_EDGE (cont_bb)->dest == body_bb + || single_succ (BRANCH_EDGE (cont_bb)->dest) == body_bb); gcc_assert (EDGE_COUNT (cont_bb->succs) == 2); trip_update_bb = split_edge (FALLTHRU_EDGE (cont_bb)); } @@ -7261,6 +7262,11 @@ expand_omp_for_static_chunk (struct omp_region *region, if (!broken_loop) { se = find_edge (cont_bb, body_bb); + if (se == NULL) + { + se = BRANCH_EDGE (cont_bb); + gcc_assert (single_succ (se->dest) == body_bb); + } if (gimple_omp_for_combined_p (fd->for_stmt)) { remove_edge (se); @@ -7351,14 +7357,25 @@ expand_omp_for_static_chunk (struct omp_region *region, if (!broken_loop) { + struct loop *loop = body_bb->loop_father; struct loop *trip_loop = alloc_loop (); trip_loop->header = iter_part_bb; trip_loop->latch = trip_update_bb; add_loop (trip_loop, iter_part_bb->loop_father); + if (loop != entry_bb->loop_father) + { + gcc_assert (loop->header == body_bb); + gcc_assert (broken_loop + || loop->latch == region->cont + || single_pred (loop->latch) == region->cont); + trip_loop->inner = loop; + return; + } + if (!gimple_omp_for_combined_p (fd->for_stmt)) { - struct loop *loop = alloc_loop (); + loop = alloc_loop (); loop->header = body_bb; if (collapse_bb == NULL) loop->latch = cont_bb; -- 1.9.1 --------------010703080802020601000705--