aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2008-12-09 04:43:24 +0000
committerTobias Grosser <grosser@gcc.gnu.org>2008-12-09 04:43:24 +0000
commite45ade7e2eab1c72de45affeb3f91cf4a5f24bd9 (patch)
tree73bad0305e53cc3e0737a0fbbf29b6ab6f3282f0
parentb16ef779830205beb18e3784c101b8f72893cdfb (diff)
downloadgcc-e45ade7e2eab1c72de45affeb3f91cf4a5f24bd9.zip
gcc-e45ade7e2eab1c72de45affeb3f91cf4a5f24bd9.tar.gz
gcc-e45ade7e2eab1c72de45affeb3f91cf4a5f24bd9.tar.bz2
re PR middle-end/38084 ([graphite] ICE : in build_graphite_scops, at graphite.c:1829)
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. From-SVN: r142578
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/graphite.c43
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr38084.c31
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-3.f9021
4 files changed, 82 insertions, 22 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0c6bae2..3e7fc4a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2008-12-09 Ben Elliston <bje@au.ibm.com>
* config/dfp-bit.c (DFP_TO_INT): Remove unnecessary cast.
diff --git a/gcc/graphite.c b/gcc/graphite.c
index 8a464c1..179d875 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;
diff --git a/gcc/testsuite/gcc.dg/graphite/pr38084.c b/gcc/testsuite/gcc.dg/graphite/pr38084.c
new file mode 100644
index 0000000..7193f96
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr38084.c
@@ -0,0 +1,31 @@
+/* { dg-options "-O3 -fgraphite-identity" } */
+
+typedef struct {
+ unsigned int avail_out;
+ void *state;
+} stream;
+
+typedef struct {
+ stream* test;
+ int num;
+} state_in;
+
+int test_in ( stream *test, int action )
+{
+ state_in* tst;
+ if (test == ((void *)0)) return (-2);
+ if (tst == ((void *)0)) return (-2);
+ if (tst->test != test) return (-2);
+ jump_here:
+ switch (tst->num) {
+ case 1:
+ return (-1);
+ case 2:
+ if (action == 0) {
+ }
+ if (action == 1) {
+ goto jump_here;
+ }
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-3.f90 b/gcc/testsuite/gfortran.dg/graphite/id-3.f90
new file mode 100644
index 0000000..394bdf7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-3.f90
@@ -0,0 +1,21 @@
+! { dg-options "-O2 -fgraphite-identity" }
+
+subroutine gentrs (ptrst, ncls, xmin, dcls, xdont, ndon)
+do icls1 = 1, ncls
+ prec: do
+ select case (isns)
+ case (-1)
+ do icls = icls1, 1, -1
+ enddo
+ case (+1)
+ do icls = icls1, ncls
+ if (xale > rtrst (icls1, icls)) then
+ endif
+ enddo
+ end select
+ enddo prec
+enddo
+contains
+real function genuni (jsee)
+end function genuni
+end subroutine gentrs