OSDN Git Service

PR tree-optimization/51596
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Dec 2011 14:24:29 +0000 (14:24 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Dec 2011 14:24:29 +0000 (14:24 +0000)
* tree-cfg.c (replace_uses_by): Call gimple_purge_dead_eh_edges
when needed.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182481 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr51596.C [new file with mode: 0644]
gcc/tree-cfg.c

index 4041507..57f9e4e 100644 (file)
@@ -1,5 +1,9 @@
 2011-12-19  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/51596
+       * tree-cfg.c (replace_uses_by): Call gimple_purge_dead_eh_edges
+       when needed.
+
        PR middle-end/51590
        PR tree-optimization/51606
        * tree-vect-patterns.c (append_pattern_def_seq, new_pattern_def_seq):
index 9752328..a7c1c48 100644 (file)
@@ -1,5 +1,8 @@
 2011-12-19  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/51596
+       * g++.dg/opt/pr51596.C: New test.
+
        PR middle-end/51590
        PR tree-optimization/51606
        * gcc.dg/vect/pr51590.c: New test.
diff --git a/gcc/testsuite/g++.dg/opt/pr51596.C b/gcc/testsuite/g++.dg/opt/pr51596.C
new file mode 100644 (file)
index 0000000..2ed9481
--- /dev/null
@@ -0,0 +1,39 @@
+// PR tree-optimization/51596
+// { dg-do compile }
+// { dg-options "-O -fnon-call-exceptions" }
+
+struct A { float v[2]; };
+struct B { int v[2]; };
+
+struct C
+{
+  B c;
+  C f ()
+  {
+    B b;
+    for (int i = 0; i < 2; i++)
+      b.v[i] = c.v[i];
+    return *this;
+  }
+};
+
+struct D
+{
+  A d;
+  D (B x)
+  {
+    for (int i = 0; i < 2; i++)
+      d.v[i] = x.v[i];
+  }
+};
+
+int bar ();
+
+C i;
+
+void
+foo ()
+{
+  while (bar ())
+    D (i.f ().c);
+}
index cd77942..df5695c 100644 (file)
@@ -1627,7 +1627,8 @@ replace_uses_by (tree name, tree val)
          if (fold_stmt (&gsi))
            stmt = gsi_stmt (gsi);
 
-         maybe_clean_or_replace_eh_stmt (orig_stmt, stmt);
+         if (maybe_clean_or_replace_eh_stmt (orig_stmt, stmt))
+           gimple_purge_dead_eh_edges (gimple_bb (stmt));
 
          update_stmt (stmt);
        }