re PR tree-optimization/71643 (internal compiler error: in redirect_eh_edge_1, at...
authorJakub Jelinek <jakub@redhat.com>
Sat, 25 Jun 2016 17:23:02 +0000 (19:23 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 25 Jun 2016 17:23:02 +0000 (19:23 +0200)
PR tree-optimization/71643
* tree-ssa-tail-merge.c (find_clusters_1): Ignore basic blocks with
EH preds.

* tree-ssa-tail-merge.c (deps_ok_for_redirect_from_bb_to_bb): Don't
leak a bitmap if dep_bb is NULL.

* g++.dg/opt/pr71643.C: New test.

From-SVN: r237783

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr71643.C [new file with mode: 0644]
gcc/tree-ssa-tail-merge.c

index b4d4b0b5f5b9c33c839019af5b7fc7e236a01253..a3a0b64781b04b77c2a3d5a5b167923137a11a43 100644 (file)
@@ -1,5 +1,12 @@
 2016-06-25  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/71643
+       * tree-ssa-tail-merge.c (find_clusters_1): Ignore basic blocks with
+       EH preds.
+
+       * tree-ssa-tail-merge.c (deps_ok_for_redirect_from_bb_to_bb): Don't
+       leak a bitmap if dep_bb is NULL.
+
        PR tree-optimization/71631
        * tree-ssa-reassoc.c (reassociate_bb): Pass true as last argument
        to rewrite_expr_tree even if negate_result, move new_lhs var
index 105f81fbd226de396f5fb30971d28d3a3dba04c4..ca690a40c0dcec67b5e077aa7418faa068dbd33a 100644 (file)
@@ -1,5 +1,8 @@
 2016-06-25  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/71643
+       * g++.dg/opt/pr71643.C: New test.
+
        PR tree-optimization/71631
        * gcc.c-torture/execute/pr71631.c: New test.
 
diff --git a/gcc/testsuite/g++.dg/opt/pr71643.C b/gcc/testsuite/g++.dg/opt/pr71643.C
new file mode 100644 (file)
index 0000000..8369c68
--- /dev/null
@@ -0,0 +1,20 @@
+// PR tree-optimization/71643
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A
+{
+  void *operator new (__SIZE_TYPE__, double);
+  void operator delete (void *, double) { __builtin_unreachable (); }
+  A (int x);
+  static A *bar (int x) { return new (3.0) A (x); }
+};
+void baz (A *, A *);
+
+void
+foo (int a, int b)
+{
+  A *p = A::bar (a);
+  A *q = A::bar (b);
+  baz (p, q);
+}
index 042d9646b74f4afd5fe72ccb6d81893f4e4960c7..5e815ec582abeadfbc51e576f0c6545799a8000c 100644 (file)
@@ -1398,11 +1398,11 @@ deps_ok_for_redirect_from_bb_to_bb (basic_block from, basic_block to)
   basic_block cd, dep_bb = BB_DEP_BB (to);
   edge_iterator ei;
   edge e;
-  bitmap from_preds = BITMAP_ALLOC (NULL);
 
   if (dep_bb == NULL)
     return true;
 
+  bitmap from_preds = BITMAP_ALLOC (NULL);
   FOR_EACH_EDGE (e, ei, from->preds)
     bitmap_set_bit (from_preds, e->src->index);
   cd = nearest_common_dominator_for_set (CDI_DOMINATORS, from_preds);
@@ -1446,7 +1446,7 @@ find_clusters_1 (same_succ *same_succ)
       /* TODO: handle blocks with phi-nodes.  We'll have to find corresponding
         phi-nodes in bb1 and bb2, with the same alternatives for the same
         preds.  */
-      if (bb_has_non_vop_phi (bb1))
+      if (bb_has_non_vop_phi (bb1) || bb_has_eh_pred (bb1))
        continue;
 
       nr_comparisons = 0;
@@ -1454,7 +1454,7 @@ find_clusters_1 (same_succ *same_succ)
        {
          bb2 = BASIC_BLOCK_FOR_FN (cfun, j);
 
-         if (bb_has_non_vop_phi (bb2))
+         if (bb_has_non_vop_phi (bb2) || bb_has_eh_pred (bb2))
            continue;
 
          if (BB_CLUSTER (bb1) != NULL && BB_CLUSTER (bb1) == BB_CLUSTER (bb2))