OSDN Git Service

2010-09-02 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Sep 2010 13:42:25 +0000 (13:42 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Sep 2010 13:42:25 +0000 (13:42 +0000)
PR tree-optimization/44937
PR tree-optimization/45412
* ipa-split.c (split_function): Properly remove PHI nodes.

* g++.dg/opt/pr45412.C: New testcase.
* gcc.c-torture/compile/pr45412.c: Likewise.
* gcc.c-torture/compile/pr44937.c: Likewise.

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

gcc/ChangeLog
gcc/ipa-split.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr45412.C [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/pr44937.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/pr45412.c [new file with mode: 0644]

index fc2ceb1..8c38f68 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-02  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/44937
+       PR tree-optimization/45412
+       * ipa-split.c (split_function): Properly remove PHI nodes.
+
 2010-09-02  Joseph Myers  <joseph@codesourcery.com>
 
        * opts.h (struct cl_option): Add warn_message field.
index 712fbf5..56f689b 100644 (file)
@@ -993,8 +993,8 @@ split_function (struct split_point *split_point)
        {
          gimple stmt = gsi_stmt (gsi);
          gcc_assert (!is_gimple_reg (gimple_phi_result (stmt)));
-         mark_sym_for_renaming (SSA_NAME_VAR (PHI_RESULT (stmt)));
-         gsi_remove (&gsi, false);
+         mark_virtual_phi_result_for_renaming (stmt);
+         remove_phi_node (&gsi, true);
        }
     }
   /* When we pass aorund the value, use existing return block.  */
index 83c17e4..1c1608f 100644 (file)
@@ -1,3 +1,11 @@
+2010-09-02  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/44937
+       PR tree-optimization/45412
+       * g++.dg/opt/pr45412.C: New testcase.
+       * gcc.c-torture/compile/pr45412.c: Likewise.
+       * gcc.c-torture/compile/pr44937.c: Likewise.
+
 2010-09-02  Joseph Myers  <joseph@codesourcery.com>
 
        * gcc.dg/cpp/warn-comments-3.c: New.  Based on warn-comments-2.c
diff --git a/gcc/testsuite/g++.dg/opt/pr45412.C b/gcc/testsuite/g++.dg/opt/pr45412.C
new file mode 100644 (file)
index 0000000..e374f52
--- /dev/null
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// { dg-options "-O2 -fipa-cp-clone -ftracer" }
+
+int foo (int *);
+void bar ();
+
+struct S
+{
+  virtual int vm ();
+  ~S ();
+};
+
+int
+S::vm ()
+{
+  int state;
+  switch (foo (&state))
+    {
+      case 0:
+         bar ();
+      case 1:
+         delete this;
+    }
+  return state;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44937.c b/gcc/testsuite/gcc.c-torture/compile/pr44937.c
new file mode 100644 (file)
index 0000000..3bb711d
--- /dev/null
@@ -0,0 +1,30 @@
+int g_19;
+int *g_42;
+int **volatile g = &g_42;
+int g_67[5][9][2][1] = {
+};
+
+int
+func_4 (int p_5, unsigned char p_6, unsigned char p_7)
+{
+  unsigned char l_8[1];
+  if (p_6)
+    goto lbl_13;
+  for (p_6 = 0; p_6; p_6 = (p_6, 0))
+    if (0)
+      {
+      }
+    else
+      lbl_13:for (p_6 = 0; p_6 < 1; p_6 += 1)
+         l_8[p_6] = 0;
+  return 0;
+}
+
+int *
+func_45 (unsigned long p_46, unsigned char p_47)
+{
+  int *l_56 = &g_19;
+  (void *)&l_56 != (void *)&g | !1 == func_4 (0, g_67[2][6][1][0], 0) ^ func_4 (1, 0, 0);
+  return 0;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45412.c b/gcc/testsuite/gcc.c-torture/compile/pr45412.c
new file mode 100644 (file)
index 0000000..339854b
--- /dev/null
@@ -0,0 +1,22 @@
+extern void baz (int, int, int);
+
+int j;
+
+int
+bar (void)
+{
+  int n = 0, *np = &n;
+  if (j)
+    baz (0, 0, 0);
+  if (j)
+    baz (0, 0, 0);
+  return n;
+}
+
+void
+foo (void)
+{
+  bar ();
+  bar ();
+}
+