From 224b4faf2097f0ed0e5a058ffee9e35fe3827bde Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Wed, 30 Nov 2005 01:53:22 -0700 Subject: tree-ssa-uncprop.c (associate_equivalences_with_edges): Properly handle SSA_NAME_OCCURS_IN_ABNORMAL_PHI. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Properly handle SSA_NAME_OCCURS_IN_ABNORMAL_PHI. * g++.old-deja/g++.law/pr25000.C: New test. From-SVN: r107710 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.old-deja/g++.law/pr25000.C | 24 ++++++++++++++++++++++++ gcc/tree-ssa-uncprop.c | 11 ++++++++--- 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.law/pr25000.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4c2e7be..8cf398b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-11-30 Jeff Law + + * tree-ssa-uncprop.c (associate_equivalences_with_edges): Properly + handle SSA_NAME_OCCURS_IN_ABNORMAL_PHI. + 2005-11-30 Jakub Jelinek * config/ia64/ia64.c (ia64_expand_tls_address): Add ORIG_OP1 argument. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 57ea16d..bca19a5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-11-30 Jeff Law + + * g++.old-deja/g++.law/pr25000.C: New test. + 2005-11-30 Jakub Jelinek * gcc.dg/tls/opt-11.c: New test. diff --git a/gcc/testsuite/g++.old-deja/g++.law/pr25000.C b/gcc/testsuite/g++.old-deja/g++.law/pr25000.C new file mode 100644 index 0000000..45d4680 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.law/pr25000.C @@ -0,0 +1,24 @@ +// { dg-do compile } +// { dg-options "-O2" } +int * f(void); +void g(int*); +bool h(void); +void Find( ) +{ + int * pRes = f(); + if( !pRes ) { + if( h()){ + if( h()){ + try + { + pRes = new int(); + f(); + }catch(int& e1 ){} + } + if( !pRes ) + f(); + } + g(pRes); + } +} + diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c index 4ca90c2..28d3850 100644 --- a/gcc/tree-ssa-uncprop.c +++ b/gcc/tree-ssa-uncprop.c @@ -92,7 +92,8 @@ associate_equivalences_with_edges (void) /* If the conditional is a single variable 'X', record 'X = 1' for the true edge and 'X = 0' on the false edge. */ - if (TREE_CODE (cond) == SSA_NAME) + if (TREE_CODE (cond) == SSA_NAME + && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (cond)) { equivalency = xmalloc (sizeof (struct edge_equivalency)); equivalency->rhs = constant_boolean_node (1, TREE_TYPE (cond)); @@ -114,6 +115,7 @@ associate_equivalences_with_edges (void) know the value of OP0 on both arms of the branch. i.e., we can record an equivalence for OP0 rather than COND. */ if (TREE_CODE (op0) == SSA_NAME + && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op0) && TREE_CODE (TREE_TYPE (op0)) == BOOLEAN_TYPE && is_gimple_min_invariant (op1)) { @@ -152,8 +154,10 @@ associate_equivalences_with_edges (void) } if (TREE_CODE (op0) == SSA_NAME + && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op0) && (is_gimple_min_invariant (op1) - || TREE_CODE (op1) == SSA_NAME)) + || (TREE_CODE (op1) == SSA_NAME + && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op1)))) { /* For IEEE, -0.0 == 0.0, so we don't necessarily know the sign of a variable compared against zero. If @@ -185,7 +189,8 @@ associate_equivalences_with_edges (void) { tree cond = SWITCH_COND (stmt); - if (TREE_CODE (cond) == SSA_NAME) + if (TREE_CODE (cond) == SSA_NAME + && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (cond)) { tree labels = SWITCH_LABELS (stmt); int i, n_labels = TREE_VEC_LENGTH (labels); -- cgit v1.1