This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, 3/5] Handle original loop tree in expand_omp_for_generic


On 10/10/15 13:06, Tom de Vries wrote:
OK, I'll repost with the patch split up, as follows:

      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

this patch handles the case that we call expand_omp_for_generic with a loop having a corresponding loop struct entry.

A similar fix was done:
- in r226427 for expand_omp_for_static_nochunk (for PR66846)
- in r227435 for expand_omp_for_static_chunk (for
  --param parloops-chunk-size)

Thanks,
- Tom
Handle original loop tree in expand_omp_for_generic

2015-09-10  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/67476
	* omp-low.c (expand_omp_for_generic): Handle original loop tree.
---
 gcc/omp-low.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index b2a93b9..15a004e 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -6439,7 +6439,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)
 	{
@@ -6516,14 +6515,22 @@ expand_omp_for_generic (struct omp_region *region,
       set_immediate_dominator (CDI_DOMINATORS, l1_bb,
 			       recompute_dominator (CDI_DOMINATORS, l1_bb));
 
+      struct loop *loop = l1_bb->loop_father;
+      add_bb_to_loop (l2_bb, entry_bb->loop_father);
+
       struct loop *outer_loop = alloc_loop ();
       outer_loop->header = l0_bb;
       outer_loop->latch = l2_bb;
       add_loop (outer_loop, l0_bb->loop_father);
 
+      /* If we already have a loop struct for the inner loop, don't allocate a
+	 new one.  */
+      if (loop != entry_bb->loop_father)
+	return;
+
       if (!gimple_omp_for_combined_p (fd->for_stmt))
 	{
-	  struct loop *loop = alloc_loop ();
+	  loop = alloc_loop ();
 	  loop->header = l1_bb;
 	  /* The loop may have multiple latches.  */
 	  add_loop (loop, outer_loop);
-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]