From: Richard Henderson Date: Fri, 17 Jun 2005 00:56:07 +0000 (-0700) Subject: re PR tree-optimization/22022 (ACATS ICE cxg1002 tree_split_edge, at tree-cfg.c:3025) X-Git-Tag: misc/cutover-cvs2svn~2292 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fbe7e2f5049874ae13b1366b69f79a1a6766b9b2;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6235f5d31409..44ed9d2d3a3d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-06-16 Richard Henderson + + PR tree-opt/22022 + * tree-complex.c (update_phi_components): Avoid no-op moves. + 2005-06-16 Joseph S. Myers * 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 000000000000..53fc7e98e3b5 --- /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 000000000000..9a3fdf3f0d23 --- /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 a4c7329d3dd4..a3470b1b7b69 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);