diff options
author | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-13 15:28:55 +0000 |
---|---|---|
committer | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-13 15:28:55 +0000 |
commit | f21dcb286d580bafe85dcfc2a5f817a16fd27fb1 (patch) | |
tree | 1dbb90005a98cf50ebb4b58c851c2129c3c1e1f4 /gcc/tree-ssa-copy.c | |
parent | a7cc94aa453a5b092723df12f2d5abe2fb7c9bbd (diff) | |
download | gcc-f21dcb286d580bafe85dcfc2a5f817a16fd27fb1.tar.gz |
gcc/
PR tree-optimization/20913
* tree-ssa-copy.c (copy_prop_visit_cond_stmt): Fold COND_EXPR.
testsuite/
PR tree-optimization/20913
* gcc.dg/tree-ssa/pr20913.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98090 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-copy.c')
-rw-r--r-- | gcc/tree-ssa-copy.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index 91d80a7aef9..b9544f88979 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -626,9 +626,16 @@ copy_prop_visit_cond_stmt (tree stmt, edge *taken_edge_p) print_generic_stmt (dump_file, cond, 0); } - *taken_edge_p = find_taken_edge (bb_for_stmt (stmt), cond); - if (*taken_edge_p) - retval = SSA_PROP_INTERESTING; + /* We can fold COND only and get a useful result only when we + have the same SSA_NAME on both sides of a comparison + operator. */ + if (TREE_CODE (TREE_OPERAND (cond, 0)) == SSA_NAME + && TREE_OPERAND (cond, 0) == TREE_OPERAND (cond, 1)) + { + *taken_edge_p = find_taken_edge (bb_for_stmt (stmt), fold (cond)); + if (*taken_edge_p) + retval = SSA_PROP_INTERESTING; + } /* Restore the original operands. */ for (i = 0; i < NUM_USES (uses); i++) |