aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-prop.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-04-18 17:26:57 +0200
committerRichard Biener <rguenther@suse.de>2023-04-24 09:35:38 +0200
commit60bf26a412a9ec2b467c04fac1dfacef2ef09c6d (patch)
treecd47590228fd0a2c9832b783373a4290605a2133 /gcc/ipa-prop.cc
parent28c06d0ed134d7d325da101e7e4230067cebeab3 (diff)
downloadgcc-60bf26a412a9ec2b467c04fac1dfacef2ef09c6d.zip
gcc-60bf26a412a9ec2b467c04fac1dfacef2ef09c6d.tar.gz
gcc-60bf26a412a9ec2b467c04fac1dfacef2ef09c6d.tar.bz2
This replaces uses of last_stmt where we do not require debug skipping
There are quite some cases which want to access the control stmt ending a basic-block. Since there cannot be debug stmts after such stmt there's no point in using last_stmt which skips debug stmts and can be a compile-time hog for larger testcases. * gimple-ssa-split-paths.cc (is_feasible_trace): Avoid last_stmt. * graphite-scop-detection.cc (single_pred_cond_non_loop_exit): Likewise. * ipa-fnsummary.cc (set_cond_stmt_execution_predicate): Likewise. (set_switch_stmt_execution_predicate): Likewise. (phi_result_unknown_predicate): Likewise. * ipa-prop.cc (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_indirect_call_uses): Likewise. * predict.cc (predict_iv_comparison): Likewise. (predict_extra_loop_exits): Likewise. (predict_loops): Likewise. (tree_predict_by_opcode): Likewise. * gimple-predicate-analysis.cc (predicate::init_from_control_deps): Likewise. * gimple-pretty-print.cc (dump_implicit_edges): Likewise. * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Likewise. (replace_phi_edge_with_variable): Likewise. (two_value_replacement): Likewise. (value_replacement): Likewise. (minmax_replacement): Likewise. (spaceship_replacement): Likewise. (cond_removal_in_builtin_zero_pattern): Likewise. * tree-ssa-reassoc.cc (maybe_optimize_range_tests): Likewise. * tree-ssa-sccvn.cc (vn_phi_eq): Likewise. (vn_phi_lookup): Likewise. (vn_phi_insert): Likewise. * tree-ssa-structalias.cc (compute_points_to_sets): Likewise. * tree-ssa-threadbackward.cc (back_threader::maybe_thread_block): Likewise. (back_threader_profitability::possibly_profitable_path_p): Likewise. * tree-ssa-threadedge.cc (jump_threader::thread_outgoing_edges): Likewise. * tree-switch-conversion.cc (pass_convert_switch::execute): Likewise. (pass_lower_switch<O0>::execute): Likewise. * tree-tailcall.cc (tree_optimize_tail_calls_1): Likewise. * tree-vect-loop-manip.cc (vect_loop_versioning): Likewise. * tree-vect-slp.cc (vect_slp_function): Likewise. * tree-vect-stmts.cc (cfun_returns): Likewise. * tree-vectorizer.cc (vect_loop_vectorized_call): Likewise. (vect_loop_dist_alias_call): Likewise.
Diffstat (limited to 'gcc/ipa-prop.cc')
-rw-r--r--gcc/ipa-prop.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
index c0143e9..a55cc72 100644
--- a/gcc/ipa-prop.cc
+++ b/gcc/ipa-prop.cc
@@ -1531,7 +1531,7 @@ compute_complex_ancestor_jump_func (struct ipa_func_body_info *fbi,
gcall *call, gphi *phi)
{
HOST_WIDE_INT offset;
- gimple *assign, *cond;
+ gimple *assign;
basic_block phi_bb, assign_bb, cond_bb;
tree tmp, parm, expr, obj;
int index, i;
@@ -1564,9 +1564,8 @@ compute_complex_ancestor_jump_func (struct ipa_func_body_info *fbi,
return;
cond_bb = single_pred (assign_bb);
- cond = last_stmt (cond_bb);
+ gcond *cond = safe_dyn_cast <gcond *> (*gsi_last_bb (cond_bb));
if (!cond
- || gimple_code (cond) != GIMPLE_COND
|| gimple_cond_code (cond) != NE_EXPR
|| gimple_cond_lhs (cond) != parm
|| !integer_zerop (gimple_cond_rhs (cond)))
@@ -2681,8 +2680,8 @@ ipa_analyze_indirect_call_uses (struct ipa_func_body_info *fbi, gcall *call,
/* Third, let's see that the branching is done depending on the least
significant bit of the pfn. */
- gimple *branch = last_stmt (bb);
- if (!branch || gimple_code (branch) != GIMPLE_COND)
+ gcond *branch = safe_dyn_cast <gcond *> (*gsi_last_bb (bb));
+ if (!branch)
return;
if ((gimple_cond_code (branch) != NE_EXPR