diff options
author | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-18 12:20:50 +0000 |
---|---|---|
committer | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-18 12:20:50 +0000 |
commit | 5d8d76f6177adce94026908252cd6055676b1f1c (patch) | |
tree | a7e63774db500194c99a26efe5321f3fdbbffe5d /gcc/tree-cfgcleanup.c | |
parent | 2a3b82778a687430db8cc86b45e9b04f939134c0 (diff) | |
download | gcc-5d8d76f6177adce94026908252cd6055676b1f1c.tar.gz |
PR tree-optimization/43402
* tree-cfgcleanup.c (cleanup_control_expr_graph): Don't follow
PHI chains of ssa names registered for update.
testsuite/
* gcc.dg/pr43402.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157538 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r-- | gcc/tree-cfgcleanup.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index eae0c84cef5..326bf80ec9a 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -103,20 +103,28 @@ cleanup_control_expr_graph (basic_block bb, gimple_stmt_iterator gsi) /* For conditions try harder and lookup single-argument PHI nodes. Only do so from the same basic-block though as other basic-blocks may be dead already. */ - if (TREE_CODE (lhs) == SSA_NAME) + if (TREE_CODE (lhs) == SSA_NAME + && !name_registered_for_update_p (lhs)) { gimple def_stmt = SSA_NAME_DEF_STMT (lhs); if (gimple_code (def_stmt) == GIMPLE_PHI && gimple_phi_num_args (def_stmt) == 1 - && gimple_bb (def_stmt) == gimple_bb (stmt)) + && gimple_bb (def_stmt) == gimple_bb (stmt) + && (TREE_CODE (PHI_ARG_DEF (def_stmt, 0)) != SSA_NAME + || !name_registered_for_update_p (PHI_ARG_DEF (def_stmt, + 0)))) lhs = PHI_ARG_DEF (def_stmt, 0); } - if (TREE_CODE (rhs) == SSA_NAME) + if (TREE_CODE (rhs) == SSA_NAME + && !name_registered_for_update_p (rhs)) { gimple def_stmt = SSA_NAME_DEF_STMT (rhs); if (gimple_code (def_stmt) == GIMPLE_PHI && gimple_phi_num_args (def_stmt) == 1 - && gimple_bb (def_stmt) == gimple_bb (stmt)) + && gimple_bb (def_stmt) == gimple_bb (stmt) + && (TREE_CODE (PHI_ARG_DEF (def_stmt, 0)) != SSA_NAME + || !name_registered_for_update_p (PHI_ARG_DEF (def_stmt, + 0)))) rhs = PHI_ARG_DEF (def_stmt, 0); } val = fold_binary_loc (loc, gimple_cond_code (stmt), |