diff options
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 0b0c510..ca78e2d 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -3028,16 +3028,13 @@ vn_phi_eq (const_vn_phi_t const vp1, const_vn_phi_t const vp2) return false; /* Verify the controlling stmt is the same. */ - gimple *last1 = last_stmt (idom1); - gimple *last2 = last_stmt (idom2); - if (gimple_code (last1) != GIMPLE_COND - || gimple_code (last2) != GIMPLE_COND) + gcond *last1 = safe_dyn_cast <gcond *> (last_stmt (idom1)); + gcond *last2 = safe_dyn_cast <gcond *> (last_stmt (idom2)); + if (! last1 || ! last2) return false; bool inverted_p; - if (! cond_stmts_equal_p (as_a <gcond *> (last1), - vp1->cclhs, vp1->ccrhs, - as_a <gcond *> (last2), - vp2->cclhs, vp2->ccrhs, + if (! cond_stmts_equal_p (last1, vp1->cclhs, vp1->ccrhs, + last2, vp2->cclhs, vp2->ccrhs, &inverted_p)) return false; @@ -3122,7 +3119,7 @@ vn_phi_lookup (gimple *phi) 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))) + if (gcond *last1 = safe_dyn_cast <gcond *> (last_stmt (idom1))) { vp1.cclhs = vn_valueize (gimple_cond_lhs (last1)); vp1.ccrhs = vn_valueize (gimple_cond_rhs (last1)); @@ -3168,7 +3165,7 @@ vn_phi_insert (gimple *phi, tree result) 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))) + if (gcond *last1 = safe_dyn_cast <gcond *> (last_stmt (idom1))) { vp1->cclhs = vn_valueize (gimple_cond_lhs (last1)); vp1->ccrhs = vn_valueize (gimple_cond_rhs (last1)); |