diff options
author | Richard Biener <rguenther@suse.de> | 2023-05-03 13:24:45 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-05-03 14:58:56 +0200 |
commit | 64780df27b41d73689cd12dfda780d75fb80d743 (patch) | |
tree | b5583ad51806ff7f2d6c99109abe9b0719be4a86 /gcc/tree-vrp.cc | |
parent | cbf6c7a1d16490a1e63e9a5ce00e9a5c44c4c2f2 (diff) | |
download | gcc-64780df27b41d73689cd12dfda780d75fb80d743.zip gcc-64780df27b41d73689cd12dfda780d75fb80d743.tar.gz gcc-64780df27b41d73689cd12dfda780d75fb80d743.tar.bz2 |
More last_stmt removal
This is the last set of changes removing calls to last_stmt in favor of
*gsi_last_bb where this is obviously correct. As with the last changes
I tried to cleanup the code as far as dependences are concerned.
* tree-ssa-loop-split.cc (split_at_bb_p): Avoid last_stmt.
(patch_loop_exit): Likewise.
(connect_loops): Likewise.
(split_loop): Likewise.
(control_dep_semi_invariant_p): Likewise.
(do_split_loop_on_cond): Likewise.
(split_loop_on_cond): Likewise.
* tree-ssa-loop-unswitch.cc (find_unswitching_predicates_for_bb):
Likewise.
(simplify_loop_version): Likewise.
(evaluate_bbs): Likewise.
(find_loop_guard): Likewise.
(clean_up_after_unswitching): Likewise.
* tree-ssa-math-opts.cc (maybe_optimize_guarding_check):
Likewise.
(optimize_spaceship): Take a gcond * argument, avoid
last_stmt.
(math_opts_dom_walker::after_dom_children): Adjust call to
optimize_spaceship.
* tree-vrp.cc (maybe_set_nonzero_bits): Avoid last_stmt.
* value-pointer-equiv.cc (pointer_equiv_analyzer::visit_edge):
Likewise.
Diffstat (limited to 'gcc/tree-vrp.cc')
-rw-r--r-- | gcc/tree-vrp.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc index 0761b68..89707a5 100644 --- a/gcc/tree-vrp.cc +++ b/gcc/tree-vrp.cc @@ -650,18 +650,17 @@ void maybe_set_nonzero_bits (edge e, tree var) { basic_block cond_bb = e->src; - gimple *stmt = last_stmt (cond_bb); + gcond *cond = safe_dyn_cast <gcond *> (*gsi_last_bb (cond_bb)); tree cst; - if (stmt == NULL - || gimple_code (stmt) != GIMPLE_COND - || gimple_cond_code (stmt) != ((e->flags & EDGE_TRUE_VALUE) + if (cond == NULL + || gimple_cond_code (cond) != ((e->flags & EDGE_TRUE_VALUE) ? EQ_EXPR : NE_EXPR) - || TREE_CODE (gimple_cond_lhs (stmt)) != SSA_NAME - || !integer_zerop (gimple_cond_rhs (stmt))) + || TREE_CODE (gimple_cond_lhs (cond)) != SSA_NAME + || !integer_zerop (gimple_cond_rhs (cond))) return; - stmt = SSA_NAME_DEF_STMT (gimple_cond_lhs (stmt)); + gimple *stmt = SSA_NAME_DEF_STMT (gimple_cond_lhs (cond)); if (!is_gimple_assign (stmt) || gimple_assign_rhs_code (stmt) != BIT_AND_EXPR || TREE_CODE (gimple_assign_rhs2 (stmt)) != INTEGER_CST) |