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, 1/5] Handle simple latch 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 simple latches in expand_omp_for_generic.

This allows us to handle loops which have the LOOPS_HAVE_SIMPLE_LATCHES property.

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 simple latch 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 simple latch.
---
 gcc/omp-low.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index cdcf9d6..f59a6a4 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -6162,7 +6162,9 @@ expand_omp_for_generic (struct omp_region *region,
   if (!broken_loop)
     {
       l2_bb = create_empty_bb (cont_bb);
-      gcc_assert (BRANCH_EDGE (cont_bb)->dest == l1_bb);
+      gcc_assert (BRANCH_EDGE (cont_bb)->dest == l1_bb
+		  || (single_succ_edge (BRANCH_EDGE (cont_bb)->dest)->dest
+		      == l1_bb));
       gcc_assert (EDGE_COUNT (cont_bb->succs) == 2);
     }
   else
@@ -6438,6 +6440,11 @@ expand_omp_for_generic (struct omp_region *region,
       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)
+	{
+	  e = BRANCH_EDGE (cont_bb);
+	  gcc_assert (single_succ (e->dest) == l1_bb);
+	}
       if (gimple_omp_for_combined_p (fd->for_stmt))
 	{
 	  remove_edge (e);
-- 
1.9.1


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