]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/22022 (ACATS ICE cxg1002 tree_split_edge, at tree-cfg.c:3025)
authorRichard Henderson <rth@redhat.com>
Fri, 17 Jun 2005 00:56:07 +0000 (17:56 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 17 Jun 2005 00:56:07 +0000 (17:56 -0700)
        PR tree-opt/22022
        * tree-complex.c (update_phi_components): Avoid no-op moves.

From-SVN: r101121

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

index 6235f5d3140910265e3f65cfa73ef4875d881104..44ed9d2d3a3d94a8279da4da2dbe5a65b1be6755 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-16  Richard Henderson  <rth@redhat.com>
+
+       PR tree-opt/22022
+       * tree-complex.c (update_phi_components): Avoid no-op moves.
+
 2005-06-16  Joseph S. Myers  <joseph@codesourcery.com>
 
        * Makefile.in (cc1-checksum.c): Use
diff --git a/gcc/testsuite/g++.dg/opt/complex2.C b/gcc/testsuite/g++.dg/opt/complex2.C
new file mode 100644 (file)
index 0000000..53fc7e9
--- /dev/null
@@ -0,0 +1,24 @@
+// PR 22022
+// { dg-do compile }
+// { dg-options "-O2" }
+
+_Complex float f();
+_Complex float g();
+_Complex float h()throw();
+void i(_Complex float)throw();
+
+void j(void)
+{
+  _Complex float x = h();
+  try
+  {
+    try
+    {
+      x = f();
+    }catch (...)
+    {
+      x = g();
+    }
+  }catch(...){}
+  i(x);
+}
diff --git a/gcc/testsuite/g++.dg/opt/complex3.C b/gcc/testsuite/g++.dg/opt/complex3.C
new file mode 100644 (file)
index 0000000..9a3fdf3
--- /dev/null
@@ -0,0 +1,24 @@
+// PR 22022
+// { dg-do compile }
+// { dg-options "-O2" }
+
+_Complex float f();
+_Complex float g();
+_Complex float h()throw();
+void i(float)throw();
+
+float j(void)
+{
+  _Complex float x = h();
+  try
+  {
+    try
+    {
+      x = f();
+    }catch (...)
+    {
+      x += g();
+    }
+  }catch(...){}
+  i(__builtin_crealf(x)+__builtin_cimagf(x));
+}
index a4c7329d3dd47e14dd08efd1fe48d3431cca2949..a3470b1b7b6977c0d562db35406353b113203978 100644 (file)
@@ -577,6 +577,12 @@ update_phi_components (basic_block bb)
            tree arg = PHI_ARG_DEF (phi, i);
            tree r, i;
 
+           /* Avoid no-op assignments.  This also prevents insertting stmts
+              onto abnormal edges, assuming the PHI isn't already broken.  */
+           if (TREE_CODE (arg) == SSA_NAME
+               && SSA_NAME_VAR (arg) == SSA_NAME_VAR (lhs))
+             continue;
+
            r = extract_component (NULL, arg, 0, false);
            i = extract_component (NULL, arg, 1, false);
            update_complex_components_on_edge (e, NULL, lhs, r, i);