diff options
author | Richard Biener <rguenther@suse.de> | 2014-07-10 14:43:07 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-07-10 14:43:07 +0000 |
commit | 218e53ea1f2b9a9a63de8ba6dc3ec0c8c1510114 (patch) | |
tree | ffe36b88fe1e96c5d3805b218586d6c452f9bd45 | |
parent | 3ed71ced71bc8f224d95aaaa45361826c024432a (diff) | |
download | gcc-218e53ea1f2b9a9a63de8ba6dc3ec0c8c1510114.zip gcc-218e53ea1f2b9a9a63de8ba6dc3ec0c8c1510114.tar.gz gcc-218e53ea1f2b9a9a63de8ba6dc3ec0c8c1510114.tar.bz2 |
re PR tree-optimization/61757 (genmodes failure with enable-checking)
2014-07-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/61757
* tree-ssa-dom.c (loop_depth_of_name): Restore.
(propagate_rhs_into_lhs): Revert part of last change.
From-SVN: r212433
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-dom.c | 30 |
2 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d09cba9..a7dcc02 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-07-10 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61757 + * tree-ssa-dom.c (loop_depth_of_name): Restore. + (propagate_rhs_into_lhs): Revert part of last change. + 2014-07-10 Thomas Schwinge <thomas@codesourcery.com> * fold-const.c (fold_checksum_tree): Look at DECL_VINDEX only for diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index ef92f30..4c0c276 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -2638,6 +2638,33 @@ get_lhs_or_phi_result (gimple stmt) gcc_unreachable (); } +/* Return the loop depth of the basic block of the defining statement of X. + This number should not be treated as absolutely correct because the loop + information may not be completely up-to-date when dom runs. However, it + will be relatively correct, and as more passes are taught to keep loop info + up to date, the result will become more and more accurate. */ + +static int +loop_depth_of_name (tree x) +{ + gimple defstmt; + basic_block defbb; + + /* If it's not an SSA_NAME, we have no clue where the definition is. */ + if (TREE_CODE (x) != SSA_NAME) + return 0; + + /* Otherwise return the loop depth of the defining statement's bb. + Note that there may not actually be a bb for this statement, if the + ssa_name is live on entry. */ + defstmt = SSA_NAME_DEF_STMT (x); + defbb = gimple_bb (defstmt); + if (!defbb) + return 0; + + return bb_loop_depth (defbb); +} + /* Propagate RHS into all uses of LHS (when possible). RHS and LHS are derived from STMT, which is passed in solely so @@ -2653,7 +2680,8 @@ static void propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_names) { /* First verify that propagation is valid. */ - if (may_propagate_copy (lhs, rhs)) + if (may_propagate_copy (lhs, rhs) + && loop_depth_of_name (lhs) >= loop_depth_of_name (rhs)) { use_operand_p use_p; imm_use_iterator iter; |