aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-02-09 07:47:07 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-02-09 07:47:07 +0000
commit9c0c77d279c6f0ea6c9d687dd9f7a1b5080b5d31 (patch)
tree72c926305ff123ca491ea3b041191a8c89bf8d6f /gcc
parent3a9abd2302fd87b38ed5a02a998560a5a58c9255 (diff)
downloadgcc-9c0c77d279c6f0ea6c9d687dd9f7a1b5080b5d31.zip
gcc-9c0c77d279c6f0ea6c9d687dd9f7a1b5080b5d31.tar.gz
gcc-9c0c77d279c6f0ea6c9d687dd9f7a1b5080b5d31.tar.bz2
re PR tree-optimization/69823 (internal compiler error: in create_pw_aff_from_tree, at graphite-sese-to-poly.c:445)
2017-02-09 Richard Biener <rguenther@suse.de> PR tree-optimization/69823 * graphite-scop-detection.c (scop_detection::harmful_loop_in_region): Properly enumerate all BBs in the region. Use auto_vec/auto_bitmap. * gcc.dg/graphite/pr69823.c: New testcase. From-SVN: r245295
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/graphite-scop-detection.c48
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr69823.c20
4 files changed, 44 insertions, 35 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8865d74..fcbb10c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/69823
+ * graphite-scop-detection.c (scop_detection::harmful_loop_in_region):
+ Properly enumerate all BBs in the region. Use auto_vec/auto_bitmap.
+
2017-02-09 Andrew Burgess <andrew.burgess@embecosm.com>
* config/arc/arc-c.def: Add __NPS400__ definition.
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index ee1f705..c372141 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1062,35 +1062,18 @@ scop_detection::harmful_loop_in_region (sese_l scop) const
print_sese (dump_file, scop));
gcc_assert (dominated_by_p (CDI_DOMINATORS, exit_bb, entry_bb));
- int depth = bb_dom_dfs_in (CDI_DOMINATORS, exit_bb)
- - bb_dom_dfs_in (CDI_DOMINATORS, entry_bb);
+ auto_vec<basic_block> worklist;
+ auto_bitmap loops;
- gcc_assert (depth > 0);
-
- vec<basic_block> dom
- = get_dominated_to_depth (CDI_DOMINATORS, entry_bb, depth);
- int i;
- basic_block bb;
- bitmap loops = BITMAP_ALLOC (NULL);
- FOR_EACH_VEC_ELT (dom, i, bb)
+ worklist.safe_push (entry_bb);
+ while (! worklist.is_empty ())
{
+ basic_block bb = worklist.pop ();
DEBUG_PRINT (dp << "Visiting bb_" << bb->index << "\n");
- /* We don't want to analyze any bb outside sese. */
- if (!dominated_by_p (CDI_POST_DOMINATORS, bb, exit_bb))
- continue;
-
- /* Basic blocks dominated by the scop->exit are not in the scop. */
- if (bb != exit_bb && dominated_by_p (CDI_DOMINATORS, bb, exit_bb))
- continue;
-
/* The basic block should not be part of an irreducible loop. */
if (bb->flags & BB_IRREDUCIBLE_LOOP)
- {
- dom.release ();
- BITMAP_FREE (loops);
- return true;
- }
+ return true;
/* Check for unstructured control flow: CFG not generated by structured
if-then-else. */
@@ -1114,13 +1097,14 @@ scop_detection::harmful_loop_in_region (sese_l scop) const
any loop fully contained in the scop: other bbs are checked below
in loop_is_valid_in_scop. */
if (harmful_stmt_in_bb (scop, bb))
- {
- dom.release ();
- BITMAP_FREE (loops);
- return true;
- }
+ return true;
}
+ if (bb != exit_bb)
+ for (basic_block dom = first_dom_son (CDI_DOMINATORS, bb);
+ dom;
+ dom = next_dom_son (CDI_DOMINATORS, dom))
+ worklist.safe_push (dom);
}
/* Go through all loops and check that they are still valid in the combined
@@ -1133,15 +1117,9 @@ scop_detection::harmful_loop_in_region (sese_l scop) const
gcc_assert (loop->num == (int) j);
if (!loop_is_valid_in_scop (loop, scop))
- {
- dom.release ();
- BITMAP_FREE (loops);
- return true;
- }
+ return true;
}
- dom.release ();
- BITMAP_FREE (loops);
return false;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ba30165..aeba293 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/69823
+ * gcc.dg/graphite/pr69823.c: New testcase.
+
2017-02-08 Pat Haugen <pthaugen@us.ibm.com>
PR target/78604
diff --git a/gcc/testsuite/gcc.dg/graphite/pr69823.c b/gcc/testsuite/gcc.dg/graphite/pr69823.c
new file mode 100644
index 0000000..6f2d35e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr69823.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -floop-nest-optimize" } */
+
+void
+foo (int c, int *p, int *a1, int *a2, int *a3)
+{
+ int i;
+
+ if (c)
+ {
+ for (i = 0; i < 8; i++)
+ a1[i] = 1;
+
+ if (*p)
+ *a2 = 0;
+ }
+
+ for (i = 0; i < 8; i++)
+ a3[i] = 0;
+}