diff options
author | Richard Biener <rguenther@suse.de> | 2017-04-20 14:23:10 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-04-20 14:23:10 +0000 |
commit | 8ee1b0a013d0bbfc70a8165a52cf64d3157c1e96 (patch) | |
tree | 164e789be3a472c505c90529a9468c6b45ff4d48 | |
parent | 798d7f42dc0c713abcf6b58ed9f1ff4e36391442 (diff) | |
download | gcc-8ee1b0a013d0bbfc70a8165a52cf64d3157c1e96.zip gcc-8ee1b0a013d0bbfc70a8165a52cf64d3157c1e96.tar.gz gcc-8ee1b0a013d0bbfc70a8165a52cf64d3157c1e96.tar.bz2 |
re PR debug/80453 (another compare-debug failure)
2017-04-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/80453
* tree-ssa-sccvn.h (struct vn_phi_s): Add cclhs and ccrhs members.
* tree-ssa-sccvn.c (cond_stmts_equal_p): Use recorded lhs and rhs
from the conditions.
(vn_phi_eq): Pass them down.
(vn_phi_lookup): Record them.
(vn_phi_insert): Likewise.
From-SVN: r247024
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 36 | ||||
-rw-r--r-- | gcc/tree-ssa-sccvn.h | 3 |
3 files changed, 39 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 80d3436..97fb5f3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2017-04-20 Richard Biener <rguenther@suse.de> + + PR tree-optimization/80453 + * tree-ssa-sccvn.h (struct vn_phi_s): Add cclhs and ccrhs members. + * tree-ssa-sccvn.c (cond_stmts_equal_p): Use recorded lhs and rhs + from the conditions. + (vn_phi_eq): Pass them down. + (vn_phi_lookup): Record them. + (vn_phi_insert): Likewise. + 2017-04-20 Matthew Fortune <matthew.fortune@imgtec.com> * config/mips/mips.c (mips_expand_vec_perm_const): Re-fix diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index bce247a..36386cf 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2916,14 +2916,11 @@ vn_phi_compute_hash (vn_phi_t vp1) the other. */ static bool -cond_stmts_equal_p (gcond *cond1, gcond *cond2, bool *inverted_p) +cond_stmts_equal_p (gcond *cond1, tree lhs1, tree rhs1, + gcond *cond2, tree lhs2, tree rhs2, bool *inverted_p) { enum tree_code code1 = gimple_cond_code (cond1); enum tree_code code2 = gimple_cond_code (cond2); - tree lhs1 = gimple_cond_lhs (cond1); - tree lhs2 = gimple_cond_lhs (cond2); - tree rhs1 = gimple_cond_rhs (cond1); - tree rhs2 = gimple_cond_rhs (cond2); *inverted_p = false; if (code1 == code2) @@ -2941,10 +2938,6 @@ cond_stmts_equal_p (gcond *cond1, gcond *cond2, bool *inverted_p) else return false; - lhs1 = vn_valueize (lhs1); - rhs1 = vn_valueize (rhs1); - lhs2 = vn_valueize (lhs2); - rhs2 = vn_valueize (rhs2); return ((expressions_equal_p (lhs1, lhs2) && expressions_equal_p (rhs1, rhs2)) || (commutative_tree_code (code1) @@ -3002,7 +2995,10 @@ vn_phi_eq (const_vn_phi_t const vp1, const_vn_phi_t const vp2) return false; bool inverted_p; if (! cond_stmts_equal_p (as_a <gcond *> (last1), - as_a <gcond *> (last2), &inverted_p)) + vp1->cclhs, vp1->ccrhs, + as_a <gcond *> (last2), + vp2->cclhs, vp2->ccrhs, + &inverted_p)) return false; /* Get at true/false controlled edges into the PHI. */ @@ -3081,6 +3077,16 @@ vn_phi_lookup (gimple *phi) vp1.type = TREE_TYPE (gimple_phi_result (phi)); vp1.phiargs = shared_lookup_phiargs; vp1.block = gimple_bb (phi); + /* Extract values of the controlling condition. */ + vp1.cclhs = NULL_TREE; + vp1.ccrhs = NULL_TREE; + basic_block idom1 = get_immediate_dominator (CDI_DOMINATORS, vp1.block); + if (EDGE_COUNT (idom1->succs) == 2) + if (gcond *last1 = dyn_cast <gcond *> (last_stmt (idom1))) + { + vp1.cclhs = vn_valueize (gimple_cond_lhs (last1)); + vp1.ccrhs = vn_valueize (gimple_cond_rhs (last1)); + } vp1.hashcode = vn_phi_compute_hash (&vp1); slot = current_info->phis->find_slot_with_hash (&vp1, vp1.hashcode, NO_INSERT); @@ -3117,6 +3123,16 @@ vn_phi_insert (gimple *phi, tree result) vp1->type = TREE_TYPE (gimple_phi_result (phi)); vp1->phiargs = args; vp1->block = gimple_bb (phi); + /* Extract values of the controlling condition. */ + vp1->cclhs = NULL_TREE; + vp1->ccrhs = NULL_TREE; + basic_block idom1 = get_immediate_dominator (CDI_DOMINATORS, vp1->block); + if (EDGE_COUNT (idom1->succs) == 2) + if (gcond *last1 = dyn_cast <gcond *> (last_stmt (idom1))) + { + vp1->cclhs = vn_valueize (gimple_cond_lhs (last1)); + vp1->ccrhs = vn_valueize (gimple_cond_rhs (last1)); + } vp1->result = result; vp1->hashcode = vn_phi_compute_hash (vp1); diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h index 4e63ad7..ec00c37 100644 --- a/gcc/tree-ssa-sccvn.h +++ b/gcc/tree-ssa-sccvn.h @@ -67,6 +67,9 @@ typedef struct vn_phi_s hashval_t hashcode; vec<tree> phiargs; basic_block block; + /* Controlling condition lhs/rhs. */ + tree cclhs; + tree ccrhs; tree type; tree result; } *vn_phi_t; |