re PR tree-optimization/92163 (ICE: Segmentation fault (in bitmap_set_bit))
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Mon, 28 Oct 2019 15:01:24 +0000 (15:01 +0000)
committerPrathamesh Kulkarni <prathamesh3492@gcc.gnu.org>
Mon, 28 Oct 2019 15:01:24 +0000 (15:01 +0000)
2019-10-28  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

PR tree-optimization/92163
* tree-ssa-dse.c (delete_dead_or_redundant_assignment): New param
need_eh_cleanup with default value NULL. Gate on need_eh_cleanup
before calling bitmap_set_bit.
(dse_optimize_redundant_stores): Pass global need_eh_cleanup to
delete_dead_or_redundant_assignment.
(dse_dom_walker::dse_optimize_stmt): Likewise.
* tree-ssa-dse.h (delete_dead_or_redundant_assignment): Adjust prototype.

testsuite/
* gcc.dg/tree-ssa/pr92163.c: New test.

From-SVN: r277525

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr92163.c [new file with mode: 0644]
gcc/tree-ssa-dse.c
gcc/tree-ssa-dse.h

index f3410ebf730d67f1e72aa4eeb89efe024c34cdbf..aa9c489b17636b8538fc840c67cc4fc9c41aa3bb 100644 (file)
@@ -1,3 +1,14 @@
+2019-10-28  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
+
+       PR tree-optimization/92163
+       * tree-ssa-dse.c (delete_dead_or_redundant_assignment): New param
+       need_eh_cleanup with default value NULL. Gate on need_eh_cleanup
+       before calling bitmap_set_bit.
+       (dse_optimize_redundant_stores): Pass global need_eh_cleanup to
+       delete_dead_or_redundant_assignment.
+       (dse_dom_walker::dse_optimize_stmt): Likewise.
+       * tree-ssa-dse.h (delete_dead_or_redundant_assignment): Adjust prototype.
+
 2019-10-28  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        PR middle-end/91272
index f46cc932a198b27c4d03502f33ffd2a4a98d4573..b7658e03628a4808026e1c33961817debaab6009 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-28  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
+
+       PR tree-optimization/92163
+       * gcc.dg/tree-ssa/pr92163.c: New test.
+
 2019-10-28  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        PR middle-end/91272
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr92163.c b/gcc/testsuite/gcc.dg/tree-ssa/pr92163.c
new file mode 100644 (file)
index 0000000..58f548f
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do "compile" } */
+/* { dg-options "-O2 -fexceptions -fnon-call-exceptions -fopenacc" } */
+
+void
+xr (int *k7)
+{
+  int qa;
+
+#pragma acc parallel
+#pragma acc loop vector
+  for (qa = 0; qa < 3; ++qa)
+    if (qa % 2 != 0)
+      k7[qa] = 0;
+    else
+      k7[qa] = 1;
+}
index 25cd4709b3111b300de80b06b59034e2a6e655a4..21a15eef6906e58632a2a52d84cd9ac48b838210 100644 (file)
@@ -77,7 +77,6 @@ along with GCC; see the file COPYING3.  If not see
    fact, they are the same transformation applied to different views of
    the CFG.  */
 
-void delete_dead_or_redundant_assignment (gimple_stmt_iterator *, const char *);
 static void delete_dead_or_redundant_call (gimple_stmt_iterator *, const char *);
 
 /* Bitmap of blocks that have had EH statements cleaned.  We should
@@ -639,7 +638,8 @@ dse_optimize_redundant_stores (gimple *stmt)
            {
              gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
              if (is_gimple_assign (use_stmt))
-               delete_dead_or_redundant_assignment (&gsi, "redundant");
+               delete_dead_or_redundant_assignment (&gsi, "redundant",
+                                                    need_eh_cleanup);
              else if (is_gimple_call (use_stmt))
                delete_dead_or_redundant_call (&gsi, "redundant");
              else
@@ -900,7 +900,8 @@ delete_dead_or_redundant_call (gimple_stmt_iterator *gsi, const char *type)
 /* Delete a dead store at GSI, which is a gimple assignment. */
 
 void
-delete_dead_or_redundant_assignment (gimple_stmt_iterator *gsi, const char *type)
+delete_dead_or_redundant_assignment (gimple_stmt_iterator *gsi, const char *type,
+                                    bitmap need_eh_cleanup)
 {
   gimple *stmt = gsi_stmt (*gsi);
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -915,7 +916,7 @@ delete_dead_or_redundant_assignment (gimple_stmt_iterator *gsi, const char *type
 
   /* Remove the dead store.  */
   basic_block bb = gimple_bb (stmt);
-  if (gsi_remove (gsi, true))
+  if (gsi_remove (gsi, true) && need_eh_cleanup)
     bitmap_set_bit (need_eh_cleanup, bb->index);
 
   /* And release any SSA_NAMEs set in this statement back to the
@@ -1059,7 +1060,7 @@ dse_dom_walker::dse_optimize_stmt (gimple_stmt_iterator *gsi)
          && !by_clobber_p)
        return;
 
-      delete_dead_or_redundant_assignment (gsi, "dead");
+      delete_dead_or_redundant_assignment (gsi, "dead", need_eh_cleanup);
     }
 }
 
index a5eccbd746dee93afc2eac6ee46a2d79cf2008e4..2658f92b1bbef783aff024307c6d77222a2901ba 100644 (file)
@@ -31,6 +31,7 @@ enum dse_store_status
 dse_store_status dse_classify_store (ao_ref *, gimple *, bool, sbitmap,
                                     bool * = NULL, tree = NULL);
 
-void delete_dead_or_redundant_assignment (gimple_stmt_iterator *, const char *);
+void delete_dead_or_redundant_assignment (gimple_stmt_iterator *, const char *,
+                                         bitmap = NULL);
 
 #endif   /* GCC_TREE_SSA_DSE_H  */