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] fix PR68428: ignore bb dominated by the scop->exit


---
 gcc/graphite-scop-detection.c           |  6 +++++-
 gcc/testsuite/gcc.dg/graphite/pr68428.c | 23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.dg/graphite/pr68428.c

diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index e42b9bf..84fe945 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1062,12 +1062,16 @@ scop_detection::harmful_stmt_in_region (sese_l scop) const
   basic_block bb;
   FOR_EACH_VEC_ELT (dom, i, bb)
     {
-      DEBUG_PRINT (dp << "\nVisiting bb_" << bb->index);
+      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)
 	{
diff --git a/gcc/testsuite/gcc.dg/graphite/pr68428.c b/gcc/testsuite/gcc.dg/graphite/pr68428.c
new file mode 100644
index 0000000..2dc63b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr68428.c
@@ -0,0 +1,23 @@
+/* { dg-options "-O2 -floop-nest-optimize" } */
+
+int au[4] = { 0 };
+
+int
+main(void)
+{
+  int dc;
+  int m7;
+  int lv;
+  int f2;
+  int uq[3] = { 1 };
+  for (dc = 0; dc < 2; ++dc) {
+    for (lv = 0; lv < 2; ++lv)
+      for (m7 = 0; m7 < 3; ++m7) {
+        if (uq[dc] == 0)
+          continue;
+        for (f2 = 0; f2 < 3; ++f2)
+          au[dc+2] = uq[f2];
+      }
+  }
+  return 0;
+}
-- 
1.9.1


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