diff options
author | vries <vries@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-13 10:08:40 +0000 |
---|---|---|
committer | vries <vries@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-13 10:08:40 +0000 |
commit | 1c6a437bd44020c37452b7fb4f565f7e7f94d56b (patch) | |
tree | 0c4fd45db39c797571ee6e306937437b02fab080 | |
parent | 41500e78a3e8ce5105423d80827893d9434564fe (diff) | |
download | gcc-1c6a437bd44020c37452b7fb4f565f7e7f94d56b.tar.gz |
Handle original loop tree in expand_omp_for_generic
2015-10-13 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/67476
* omp-low.c (expand_omp_for_generic): Handle original loop tree.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228754 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/omp-low.c | 30 |
2 files changed, 26 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5ede0bda31..4632387b2ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-10-13 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/67476 + * omp-low.c (expand_omp_for_generic): Handle original loop tree. + 2015-10-13 Richard Biener <rguenther@suse.de> * tree-vect-data-refs.c (vect_analyze_data_ref_dependences): Allocate diff --git a/gcc/omp-low.c b/gcc/omp-low.c index b2a93b99c7e..7e894e4da7a 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,17 +6515,30 @@ 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 = alloc_loop (); - outer_loop->header = l0_bb; - outer_loop->latch = l2_bb; - add_loop (outer_loop, l0_bb->loop_father); + /* 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; - if (!gimple_omp_for_combined_p (fd->for_stmt)) + add_bb_to_loop (l2_bb, outer_loop); + + /* We've added a new loop around the original loop. Allocate the + corresponding loop struct. */ + struct loop *new_loop = alloc_loop (); + new_loop->header = l0_bb; + new_loop->latch = l2_bb; + add_loop (new_loop, outer_loop); + + /* 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); } } } |