aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2005-06-16 17:56:07 -0700
committerRichard Henderson <rth@gcc.gnu.org>2005-06-16 17:56:07 -0700
commitfbe7e2f5049874ae13b1366b69f79a1a6766b9b2 (patch)
tree90d35f461b3e1c2cf5dbcd8e239a2a2aeb507817 /gcc
parent73194ef6602284f15e4befb91a06242282ba68cd (diff)
downloadgcc-fbe7e2f5049874ae13b1366b69f79a1a6766b9b2.zip
gcc-fbe7e2f5049874ae13b1366b69f79a1a6766b9b2.tar.gz
gcc-fbe7e2f5049874ae13b1366b69f79a1a6766b9b2.tar.bz2
re PR tree-optimization/22022 (ACATS ICE cxg1002 tree_split_edge, at tree-cfg.c:3025)
PR tree-opt/22022 * tree-complex.c (update_phi_components): Avoid no-op moves. From-SVN: r101121
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/opt/complex2.C24
-rw-r--r--gcc/testsuite/g++.dg/opt/complex3.C24
-rw-r--r--gcc/tree-complex.c6
4 files changed, 59 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6235f5d..44ed9d2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
index 0000000..53fc7e9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/complex2.C
@@ -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
index 0000000..9a3fdf3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/complex3.C
@@ -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));
+}
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index a4c7329..a3470b1 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -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);