summaryrefslogtreecommitdiff
path: root/gcc/graphite.c
diff options
context:
space:
mode:
authorgrosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-09 04:43:24 +0000
committergrosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-09 04:43:24 +0000
commit2e29b3495b56a1fd93094a83ee640402eef26ff6 (patch)
tree73bad0305e53cc3e0737a0fbbf29b6ab6f3282f0 /gcc/graphite.c
parent8db15d8af2b47fcb39736c29b03eea7ba6e710bd (diff)
downloadgcc-2e29b3495b56a1fd93094a83ee640402eef26ff6.tar.gz
2008-12-09 Tobias Grosser <grosser@fim.uni-passau.de>
PR middle-end/38084 Fix testsuite/gfortran.dg/graphite/id-3.f90. * graphite.c (scopdet_basic_block_info): Fix bug that found some regions more than once. * testsuite/gfortran.dg/graphite/id-3.f90: New. * gcc/testsuite/gcc.dg/graphite/pr38084.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142578 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite.c')
-rw-r--r--gcc/graphite.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/gcc/graphite.c b/gcc/graphite.c
index 8a464c19b3d..179d8757cab 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -1318,7 +1318,7 @@ scopdet_basic_block_info (basic_block bb, VEC (sd_region, heap) **scops,
case GBB_LOOP_MULT_EXIT_HEADER:
{
- /* XXX: For now we just do not join loops with multiple exits. If the
+ /* XXX: For now we just do not join loops with multiple exits. If the
exits lead to the same bb it may be possible to join the loop. */
VEC (sd_region, heap) *tmp_scops = VEC_alloc (sd_region, heap, 3);
VEC (edge, heap) *exits = get_loop_exit_edges (loop);
@@ -1326,28 +1326,27 @@ scopdet_basic_block_info (basic_block bb, VEC (sd_region, heap) **scops,
int i;
build_scops_1 (bb, &tmp_scops, loop);
-
- /* Start at all bbs dominated by a loop exit that only exists in this
- loop. */
+ /* Scan the code dominated by this loop. This means all bbs, that are
+ are dominated by a bb in this loop, but are not part of this loop.
+
+ The easiest case:
+ - The loop exit destination is dominated by the exit sources.
+
+ TODO: We miss here the more complex cases:
+ - The exit destinations are dominated by another bb inside the
+ loop.
+ - The loop dominates bbs, that are not exit destinations. */
for (i = 0; VEC_iterate (edge, exits, i, e); i++)
- if (e->src->loop_father == loop)
- {
- VEC (basic_block, heap) *dominated;
- basic_block b;
- int j;
- dominated = get_dominated_by (CDI_DOMINATORS, e->src);
- for (j = 0; VEC_iterate (basic_block, dominated, j, b); j++)
- /* Loop exit. */
- if (loop_depth (find_common_loop (loop, b->loop_father))
- < loop_depth (loop))
- {
- /* Pass loop_outer to recognize b as loop header in
- build_scops_1. */
- if (b->loop_father->header == b)
- build_scops_1 (b, &tmp_scops, loop_outer (b->loop_father));
- else
- build_scops_1 (b, &tmp_scops, b->loop_father);
- }
+ if (e->src->loop_father == loop
+ && dominated_by_p (CDI_DOMINATORS, e->dest, e->src))
+ {
+ /* Pass loop_outer to recognize e->dest as loop header in
+ build_scops_1. */
+ if (e->dest->loop_father->header == e->dest)
+ build_scops_1 (e->dest, &tmp_scops,
+ loop_outer (e->dest->loop_father));
+ else
+ build_scops_1 (e->dest, &tmp_scops, e->dest->loop_father);
}
result.next = NULL;