From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90436 invoked by alias); 14 Jun 2015 22:38:45 -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 90422 invoked by uid 89); 14 Jun 2015 22:38:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 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; Sun, 14 Jun 2015 22:38:42 +0000 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 1Z4GY1-0003Q4-Pk from Tom_deVries@mentor.com ; Sun, 14 Jun 2015 15:38:38 -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; Sun, 14 Jun 2015 23:38:36 +0100 Message-ID: <557E0267.40503@mentor.com> Date: Sun, 14 Jun 2015 22:48:00 -0000 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: Richard Biener CC: Bernhard Reutner-Fischer , GCC Patches Subject: Re: [PATCH, stage1] Make parloops gate more strict References: <5502BCA2.2010802@mentor.com> <557D419F.2090704@mentor.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------030507090600040802020207" X-SW-Source: 2015-06/txt/msg00984.txt.bz2 --------------030507090600040802020207 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1972 On 14/06/15 23:49, Bernhard Reutner-Fischer wrote: > On June 14, 2015 10:55:59 AM GMT+02:00, Tom de Vries wrote: >> On 13/03/15 11:36, Richard Biener wrote: >>> On Fri, Mar 13, 2015 at 11:32 AM, Tom de Vries >> wrote: >>>> Hi, >>>> >>>> this patch moves a bunch of early-out tests from the parloops pass >> to the >>>> gate function. >>>> >>>> The only effect is for functions that we don't consider at all for >>>> parallelization in the parloops pass. We no longer dump those in the >>>> parloops dump file. >>>> >>>> Bootstrapped and reg-tested on x86_64. >>>> >>>> OK for stage1 trunk? >>> >>> Does it work with -fdump-passes? >>> >> >> Hi, >> >> with -fdump-passes now fixed to work on a dummy function (r222129), I'm >> >> resubmitting this patch, split up in two patches. >> >> The first patch moves two trivial early-exit tests to the parloops >> gate. >> >> The second patch moves the number_of_loops test to the parloops gate, >> and adds a dummy loops structure in the dummy function for >> -fdump-passes. >> >> Bootstrapped and reg-tested on x86_64. >> >> Both patches OK for trunk? > > diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c > index 02f44eb..a1659a3 100644 > --- a/gcc/tree-parloops.c > +++ b/gcc/tree-parloops.c > @@ -2535,10 +2535,6 @@ parallelize_loops (void) > source_location loop_loc; > > /* Do not parallelize loops in the functions created by parallelization. */ > - if (parallelized_function_p (cfun->decl)) > - return false; > - if (cfun->has_nonlocal_label) > - return false; > > gcc_obstack_init (&parloop_obstack); > reduction_info_table_type reduction_list (10); > > Now stray comment? > Stopped reading here. > Fixed in updated patch. Also: - made sure cfun is not used in the gate function - added missing update of function header comment for init_loops_structure - improved comment in pass_manager::dump_passes. OK for trunk? Thanks, - Tom --------------030507090600040802020207 Content-Type: text/x-patch; name="0001-Move-parallelize_loops-tests-to-parloops-gate.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0001-Move-parallelize_loops-tests-to-parloops-gate.patch" Content-length: 1391 [PATCH 1/2] Move parallelize_loops tests to parloops gate 2015-06-08 Tom de Vries * tree-parloops.c (parallelize_loops): Move early-exit tests to ... (pass_parallelize_loops::gate): ... here. --- gcc/tree-parloops.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 3495ac1..50b8d75 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2531,12 +2531,6 @@ parallelize_loops (void) HOST_WIDE_INT estimated; source_location loop_loc; - /* Do not parallelize loops in the functions created by parallelization. */ - if (parallelized_function_p (cfun->decl)) - return false; - if (cfun->has_nonlocal_label) - return false; - gcc_obstack_init (&parloop_obstack); reduction_info_table_type reduction_list (10); init_stmt_vec_info_vec (); @@ -2654,7 +2648,14 @@ public: {} /* opt_pass methods: */ - virtual bool gate (function *) { return flag_tree_parallelize_loops > 1; } + virtual bool gate (function *fun) + { + return (flag_tree_parallelize_loops > 1 + /* Do not parallelize loops in the functions created by + parallelization. */ + && !parallelized_function_p (fun->decl) + && !fun->has_nonlocal_label); + } virtual unsigned int execute (function *); }; // class pass_parallelize_loops -- 1.9.1 --------------030507090600040802020207 Content-Type: text/x-patch; name="0002-Move-parloops-execute-test-to-parloops-gate.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0002-Move-parloops-execute-test-to-parloops-gate.patch" Content-length: 5917 [PATCH 2/2] Move parloops::execute test to parloops gate 2015-06-11 Tom de Vries * cfgloop.c (init_loops_structure): Add and handle dummy_p parameter. (flow_loops_find): Add extra argument to call to init_loops_structure. * cfgloop.h (init_loops_structure): Add bool parameter. * cgraphunit.c (init_lowered_empty_function): Add extra argument to call to init_loops_structure. * lto-streamer-in.c (input_cfg): Same. * tree-cfg.c (move_sese_region_to_fn): Same. * passes.c (pass_manager::dump_passes): Add dummy loops structure to dummy function. * tree-parloops.c (pass_parallelize_loops::execute): Move early-exit test to .. (pass_parallelize_loops::gate): ... here. --- gcc/cfgloop.c | 22 +++++++++++++--------- gcc/cfgloop.h | 2 +- gcc/cgraphunit.c | 2 +- gcc/lto-streamer-in.c | 2 +- gcc/passes.c | 4 ++++ gcc/tree-cfg.c | 2 +- gcc/tree-parloops.c | 6 ++---- 7 files changed, 23 insertions(+), 17 deletions(-) diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index 20b81b3..2335ecb 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -349,11 +349,12 @@ alloc_loop (void) } /* Initializes loops structure LOOPS, reserving place for NUM_LOOPS loops - (including the root of the loop tree). */ + (including the root of the loop tree). If DUMMY_P, don't use information + from FN. */ void -init_loops_structure (struct function *fn, - struct loops *loops, unsigned num_loops) +init_loops_structure (struct function *fn, struct loops *loops, + unsigned num_loops, bool dummy_p) { struct loop *root; @@ -362,11 +363,14 @@ init_loops_structure (struct function *fn, /* Dummy loop containing whole function. */ root = alloc_loop (); - root->num_nodes = n_basic_blocks_for_fn (fn); - root->latch = EXIT_BLOCK_PTR_FOR_FN (fn); - root->header = ENTRY_BLOCK_PTR_FOR_FN (fn); - ENTRY_BLOCK_PTR_FOR_FN (fn)->loop_father = root; - EXIT_BLOCK_PTR_FOR_FN (fn)->loop_father = root; + if (!dummy_p) + { + root->num_nodes = n_basic_blocks_for_fn (fn); + root->latch = EXIT_BLOCK_PTR_FOR_FN (fn); + root->header = ENTRY_BLOCK_PTR_FOR_FN (fn); + ENTRY_BLOCK_PTR_FOR_FN (fn)->loop_father = root; + EXIT_BLOCK_PTR_FOR_FN (fn)->loop_father = root; + } loops->larray->quick_push (root); loops->tree_root = root; @@ -423,7 +427,7 @@ flow_loops_find (struct loops *loops) if (!loops) { loops = ggc_cleared_alloc (); - init_loops_structure (cfun, loops, 1); + init_loops_structure (cfun, loops, 1, false); } /* Ensure that loop exits were released. */ diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index c73ad7f..93ef0d2 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -257,7 +257,7 @@ struct GTY (()) loops { /* Loop recognition. */ bool bb_loop_header_p (basic_block); -void init_loops_structure (struct function *, struct loops *, unsigned); +void init_loops_structure (struct function *, struct loops *, unsigned, bool); extern struct loops *flow_loops_find (struct loops *); extern void disambiguate_loops_with_multiple_latches (void); extern void flow_loops_free (struct loops *); diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 3aadf28..603ed38 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1407,7 +1407,7 @@ init_lowered_empty_function (tree decl, bool in_ssa, gcov_type count) | PROP_cfg | PROP_loops); set_loops_for_fn (cfun, ggc_cleared_alloc ()); - init_loops_structure (cfun, loops_for_fn (cfun), 1); + init_loops_structure (cfun, loops_for_fn (cfun), 1, false); loops_for_fn (cfun)->state |= LOOPS_MAY_HAVE_MULTIPLE_LATCHES; /* Create BB for body of the function and connect it properly. */ diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 7729b6c..ad0d4ef 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -839,7 +839,7 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in, return; struct loops *loops = ggc_cleared_alloc (); - init_loops_structure (fn, loops, n_loops); + init_loops_structure (fn, loops, n_loops, false); set_loops_for_fn (fn, loops); /* Input each loop and associate it with its loop header so diff --git a/gcc/passes.c b/gcc/passes.c index d3ffe33..174ec90 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -990,6 +990,10 @@ pass_manager::dump_passes () const { push_dummy_function (true); + /* Push dummy loops structure. */ + set_loops_for_fn (cfun, ggc_cleared_alloc ()); + init_loops_structure (cfun, loops_for_fn (cfun), 1, true); + create_pass_tab (); dump_pass_list (all_lowering_passes, 1); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 9430151..2eae0d1 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -7115,7 +7115,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, /* Initialize an empty loop tree. */ struct loops *loops = ggc_cleared_alloc (); - init_loops_structure (dest_cfun, loops, 1); + init_loops_structure (dest_cfun, loops, 1, false); loops->state = LOOPS_MAY_HAVE_MULTIPLE_LATCHES; set_loops_for_fn (dest_cfun, loops); diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 50b8d75..b056110 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2654,7 +2654,8 @@ public: /* Do not parallelize loops in the functions created by parallelization. */ && !parallelized_function_p (fun->decl) - && !fun->has_nonlocal_label); + && !fun->has_nonlocal_label + && number_of_loops (fun) > 1); } virtual unsigned int execute (function *); @@ -2663,9 +2664,6 @@ public: unsigned pass_parallelize_loops::execute (function *fun) { - if (number_of_loops (fun) <= 1) - return 0; - if (parallelize_loops ()) { fun->curr_properties &= ~(PROP_gimple_eomp); -- 1.9.1 --------------030507090600040802020207--