GCC Middle and Back End API Reference
|
Go to the source code of this file.
|
extern |
Records estimates on numbers of iterations of LOOP. If USE_UNDEFINED_P is true also use estimates derived from undefined behavior.
References loop::any_estimate, loop::any_upper_bound, tree_niter_desc::bound, build3(), build_int_cst(), derive_constant_upper_bound(), discover_iteration_bound_by_body_walk(), dump_file, dump_flags, dyn_cast(), EST_AVAILABLE, EST_NOT_COMPUTED, loop::estimate_state, expected_loop_iterations_by_profile(), FOR_EACH_VEC_ELT, free(), get_loop_body(), get_loop_exit_edges(), get_upper_bound_based_on_builtin_expr_with_prob(), gsi_last_bb(), i, infer_loop_bounds_from_undefined(), last_nondebug_stmt(), tree_niter_desc::max, maybe_lower_iteration_bound(), wi::min_precision(), loop::nb_iterations, loop::nb_iterations_upper_bound, niter_desc::niter, tree_niter_desc::niter, NULL, NULL_TREE, loop::num, number_of_iterations_exit(), number_of_latch_executions(), record_control_iv(), record_estimate(), record_niter_bound(), SIGNED, single_likely_exit(), TDF_DETAILS, sreal::to_nearest_int(), wi::to_widest(), TREE_CODE, TREE_TYPE, and type().
Referenced by canonicalize_induction_variables(), estimate_numbers_of_iterations(), estimated_loop_iterations(), likely_max_loop_iterations(), loop_exits_before_overflow(), max_loop_iterations(), and tree_unroll_loops_completely().
|
extern |
Records estimates on numbers of iterations of loops.
References estimate_numbers_of_iterations(), fold_defer_overflow_warnings(), and fold_undefer_and_ignore_overflow_warnings().
|
extern |
Sets NIT to the estimated number of executions of the latch of the LOOP. If CONSERVATIVE is true, we must be sure that NIT is at least as large as the number of iterations. If we have no reliable estimate, the function returns false, otherwise returns true.
References estimate_numbers_of_iterations(), get_estimated_loop_iterations(), and scev_initialized_p().
Referenced by estimated_loop_iterations_int(), and estimated_stmt_executions().
|
extern |
Similar to estimated_loop_iterations, but returns the estimate only if it fits to HOST_WIDE_INT. If this is not the case, or the estimate on the number of iterations of LOOP could not be derived, returns -1.
References estimated_loop_iterations(), wi::fits_shwi_p(), and generic_wide_int< storage >::to_shwi().
Referenced by estimated_stmt_executions_int(), loop_distribution::execute(), parallelize_loops(), tree_ssa_unswitch_loops(), tree_unswitch_outer_loop(), and try_peel_loop().
|
extern |
Sets NIT to the estimated number of executions of the latch of the LOOP, plus one. If we have no reliable estimate, the function returns false, otherwise returns true.
References estimated_loop_iterations(), and wi::gtu_p().
Referenced by predict_loops(), and vect_create_loop_vinfo().
|
extern |
Returns an estimate for the number of executions of statements in the LOOP. For statements before the loop exit, this exceeds the number of execution of the latch by one.
References estimated_loop_iterations_int().
Referenced by avg_loop_niter(), determine_loop_nest_reuse(), loop_prefetch_arrays(), and vect_analyze_loop_costing().
Header file for loop interation estimates. Copyright (C) 2013-2024 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
References cache, and expand_simple_operations().
Try to determine the number of iterations of LOOP. If we succeed, expression giving number of iterations is returned and *EXIT is set to the edge from that the information is obtained. Otherwise chrec_dont_know is returned.
References build_int_cst(), chrec_dont_know, FOR_EACH_VEC_ELT, get_loop_exit_edges(), i, integer_nonzerop(), integer_zerop(), tree_niter_desc::may_be_zero, tree_niter_desc::niter, NULL, NULL_TREE, number_of_iterations_exit(), TREE_CODE, tree_int_cst_lt(), and unsigned_type_node.
Referenced by canonicalize_loop_induction_variables().
Finds the exit of the LOOP by that the loop exits after a constant number of iterations and stores the exit edge to *EXIT. The constant giving the number of iterations of LOOP is returned. The number of iterations is determined using loop_niter_by_eval (i.e. by brute force evaluation). If we are unable to find the exit for that loop_niter_by_eval determines the number of iterations, chrec_dont_know is returned.
References chrec_contains_undetermined(), chrec_dont_know, FOR_EACH_VEC_ELT, get_loop_exit_edges(), i, just_once_each_iteration_p(), loop_niter_by_eval(), tree_niter_desc::niter, NULL, NULL_TREE, and tree_int_cst_lt().
Referenced by canonicalize_loop_induction_variables().
Return true if loop is known to have bounded number of iterations.
References loop::any_upper_bound, current_function_decl, dump_file, dump_flags, ECF_CONST, ECF_LOOPING_CONST_OR_PURE, ECF_PURE, loop::finite_p, flags_from_decl_or_type(), FOR_EACH_VEC_ELT, get_loop_exit_edges(), i, max_loop_iterations(), loop::num, and TDF_DETAILS.
Referenced by fill_always_executed_in_1(), find_always_executed_bbs(), find_obviously_necessary_stmts(), find_simple_exit(), and finite_function_p().
|
extern |
Frees the information on upper bounds on numbers of iterations of LOOP.
References nb_iter_bound::bound, loop::bounds, loop::control_ivs, EST_NOT_COMPUTED, loop::estimate_state, ggc_free(), loop::nb_iterations, control_iv::next, nb_iter_bound::next, and NULL.
Referenced by canonicalize_induction_variables(), cleanup_tree_cfg_noloop(), fini_copy_prop(), free_numbers_of_iterations_estimates(), gen_parallel_loop(), tree_loop_interchange::interchange_loops(), loop_optimizer_finalize(), move_sese_region_to_fn(), perform_tree_ssa_dce(), remove_bb(), remove_edge_and_dominated_blocks(), remove_forwarder_block_with_phi(), scev_finalize(), tree_ssa_iv_optimize(), tree_ssa_loop_done(), tree_unroll_loops_completely(), vect_analyze_loop(), and vect_free_loop_info_assumptions().
|
extern |
Frees the information on upper bounds on numbers of iterations of loops.
References free_numbers_of_iterations_estimates().
|
extern |
Sets NIT to an likely upper bound for the maximum number of executions of the latch of the LOOP. If we have no reliable estimate, the function returns false, otherwise returns true.
References estimate_numbers_of_iterations(), get_likely_max_loop_iterations(), and scev_initialized_p().
Referenced by likely_max_loop_iterations_int(), and likely_max_stmt_executions().
|
extern |
Similar to max_loop_iterations, but returns the estimate only if it fits to HOST_WIDE_INT. If this is not the case, or the estimate on the number of iterations of LOOP could not be derived, returns -1.
References wi::fits_shwi_p(), likely_max_loop_iterations(), and generic_wide_int< storage >::to_shwi().
Referenced by canonicalize_loop_induction_variables(), loop_distribution::execute(), predict_loops(), tree_ssa_unswitch_loops(), tree_unswitch_outer_loop(), and try_peel_loop().
|
extern |
Sets NIT to the estimated maximum number of executions of the latch of the LOOP, plus one. If we have no likely estimate, the function returns false, otherwise returns true.
References wi::gtu_p(), and likely_max_loop_iterations().
Referenced by predict_loops().
|
extern |
Returns an likely upper bound on the number of executions of statements in the LOOP. For statements before the loop exit, this exceeds the number of execution of the latch by one.
References get_likely_max_loop_iterations_int().
Referenced by avg_loop_niter(), vector_costs::compare_inside_loop_cost(), loop_prefetch_arrays(), vect_analyze_loop_costing(), and vect_need_peeling_or_partial_vectors_p().
Tries to count the number of iterations of LOOP till it exits by EXIT by brute force -- i.e. by determining the value of the operands of the condition at EXIT in first few iterations of the loop (assuming that these values are constant) and determining the first one in that the condition is not satisfied. Returns the constant giving the number of the iterations of LOOP if successful, chrec_dont_know otherwise.
References boolean_type_node, build_int_cst(), chrec_dont_know, tree_niter_desc::cmp, dump_file, dump_flags, fold_binary, fold_defer_overflow_warnings(), fold_undefer_and_ignore_overflow_warnings(), get_base_for(), get_val_for(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gsi_last_bb(), i, integer_zerop(), invert_tree_comparison(), is_gimple_min_invariant(), loop_latch_edge(), loop_preheader_edge(), MAX_ITERATIONS_TO_TRACK, NULL_TREE, loop::num, PHI_ARG_DEF_FROM_EDGE, safe_dyn_cast(), TDF_DETAILS, and unsigned_type_node.
Referenced by find_loop_niter_by_eval(), and predict_loops().
|
extern |
Returns true if EXIT is the only possible exit from LOOP.
References gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), i, loop::num_nodes, single_exit(), and stmt_can_terminate_bb_p().
Referenced by number_of_iterations_exit_assumptions(), and tree_ssa_iv_optimize_loop().
|
extern |
Sets NIT to an upper bound for the maximum number of executions of the latch of the LOOP. If we have no reliable estimate, the function returns false, otherwise returns true.
References estimate_numbers_of_iterations(), get_max_loop_iterations(), and scev_initialized_p().
Referenced by finite_loop_p(), idx_within_array_bound(), loop_exits_before_overflow(), max_loop_iterations_int(), max_stmt_executions(), may_eliminate_iv(), range_of_var_in_loop(), try_transform_to_exit_first_loop_alt(), vect_iv_limit_for_partial_vectors(), vect_min_prec_for_max_niters(), vect_truncate_gather_scatter_offset(), and vectorizable_reduction().
|
extern |
Similar to max_loop_iterations, but returns the estimate only if it fits to HOST_WIDE_INT. If this is not the case, or the estimate on the number of iterations of LOOP could not be derived, returns -1.
References wi::fits_shwi_p(), max_loop_iterations(), and generic_wide_int< storage >::to_shwi().
Referenced by canonicalize_loop_induction_variables(), and predict_loops().
|
extern |
Sets NIT to the maximum number of executions of the latch of the LOOP, plus one. If we have no reliable estimate, the function returns false, otherwise returns true.
References wi::gtu_p(), and max_loop_iterations().
Referenced by is_nonwrapping_integer_induction(), and max_stmt_executions_tree().
|
extern |
Returns an upper bound on the number of executions of statements in the LOOP. For statements before the loop exit, this exceeds the number of execution of the latch by one.
References get_max_loop_iterations_int().
Referenced by analyze_siv_subscript_cst_affine(), analyze_subscript_affine_affine(), compute_overlap_steps_for_affine_1_2(), and vect_known_niters_smaller_than_vf().
Returns true if the arithmetics in TYPE can be assumed not to wrap.
References ANY_INTEGRAL_TYPE_P, POINTER_TYPE_P, and TYPE_OVERFLOW_UNDEFINED.
Referenced by bound_difference_of_offsetted_base(), convert_affine_scev(), determine_value_range(), difference_cannot_overflow_p(), idx_find_step(), infer_loop_bounds_from_pointer_arith(), iv_elimination_compare_lt(), refine_bounds_using_guard(), refine_value_range_using_guard(), scev_probably_wraps_p(), and simple_iv_with_niters().
|
extern |
Like number_of_iterations_exit_assumptions, but return TRUE only if the niter information holds unconditionally.
References tree_niter_desc::assumptions, dump_enabled_p(), dump_printf_loc(), integer_nonzerop(), MSG_MISSED_OPTIMIZATION, and number_of_iterations_exit_assumptions().
Referenced by analyze_function_body(), can_unroll_loop_p(), canonicalize_loop_induction_variables(), estimate_numbers_of_iterations(), find_loop_niter(), niter_for_exit(), number_of_latch_executions(), predict_loops(), remove_redundant_iv_tests(), split_loop(), try_get_loop_niter(), and unroll_jam_possible_p().
|
extern |
Stores description of number of iterations of LOOP derived from EXIT (an exit edge of the LOOP) in NITER. Returns true if some useful information could be derived (and fields of NITER have meaning described in comments at class tree_niter_desc declaration), false otherwise. When EVERY_ITERATION is true, only tests that are known to be executed every iteration are considered (i.e. only test that alone bounds the loop). If AT_STMT is not NULL, this function stores LOOP's condition statement in it when returning true.
References tree_niter_desc::assumptions, affine_iv::base, boolean_false_node, boolean_true_node, boolean_type_node, CDI_DOMINATORS, tree_niter_desc::control, dominated_by_p(), expand_simple_operations(), fold_build2, fold_convert, fold_defer_overflow_warnings(), fold_undefer_and_ignore_overflow_warnings(), free(), get_loop_body(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gsi_last_bb(), integer_nonzerop(), integer_zerop(), invert_tree_comparison(), loop::latch, LOOP_C_FINITE, LOOP_C_INFINITE, loop_constraint_set_p(), loop_containing_stmt(), loop_only_exit_p(), tree_niter_desc::max, tree_niter_desc::may_be_zero, tree_niter_desc::niter, affine_iv::no_overflow, NULL, NULL_TREE, number_of_iterations_bitcount(), number_of_iterations_cltz(), number_of_iterations_cond(), POINTER_TYPE_P, safe_dyn_cast(), simple_iv_with_niters(), simplify_using_initial_conditions(), simplify_using_outer_evolutions(), affine_iv::step, wi::to_widest(), TREE_CODE, TREE_TYPE, and type().
Referenced by number_of_iterations_exit(), vec_init_loop_exit_info(), and vect_get_loop_niters().
|
extern |
Return false only when the induction variable BASE + STEP * I is known to not overflow: i.e. when the number of iterations is small enough with respect to the step and initial condition in order to keep the evolution confined in TYPEs bounds. Return true when the iv is known to overflow or when the property is not computable. USE_OVERFLOW_SEMANTICS is true if this function should assume that the rules for overflow of the given language apply (e.g., that signed arithmetics in C does not overflow). If VAR is a ssa variable, this function also returns false if VAR can be proven not overflow with value range info.
References analyze_scalar_evolution(), chrec_contains_undetermined(), integer_zerop(), loop_exits_before_overflow(), nonwrapping_chrec_p(), nowrap_type_p(), scev_var_range_cant_overflow(), TREE_CODE, and TREE_TYPE.
Referenced by convert_affine_scev(), get_scev_info(), and idx_infer_loop_bounds().
|
extern |
Substitute NEW_TREE for OLD in EXPR and fold the result. If VALUEIZE is non-NULL then OLD and NEW_TREE are ignored and instead all SSA names are replaced with the result of calling the VALUEIZE function with the SSA name as argument.
References CONSTANT_CLASS_P, copy_node(), expr, EXPR_P, fold(), i, NULL_TREE, operand_equal_p(), simplify_replace_tree(), TREE_CODE, TREE_OPERAND, TREE_OPERAND_LENGTH, and unshare_expr().
Referenced by process_bb(), simplify_replace_tree(), substitute_in_loop_info(), tree_simplify_using_condition_1(), and update_epilogue_loop_vinfo().
Tries to simplify EXPR using the conditions on entry to LOOP. Returns the simplified expression (or EXPR unchanged, if no simplification was possible).
References as_a(), boolean_type_node, CDI_DOMINATORS, cfun, ENTRY_BLOCK_PTR_FOR_FN, expand_simple_operations(), expr, fold_build2, get_immediate_dominator(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gsi_last_bb(), loop::header, integer_nonzerop(), integer_zerop(), invert_truthvalue, MAX_DOMINATORS_TO_WALK, operand_equal_p(), single_pred_edge(), single_pred_p(), TREE_CODE, and tree_simplify_using_condition().
Referenced by loop_exits_before_overflow(), number_of_iterations_cltz(), number_of_iterations_cltz_complement(), number_of_iterations_exit_assumptions(), number_of_iterations_ne(), number_of_iterations_popcount(), number_of_iterations_until_wrap(), and simple_iv_with_niters().
Returns true if statement S1 dominates statement S2.
References CDI_DOMINATORS, dominated_by_p(), gimple_bb(), gsi_next(), gsi_start_bb(), and gsi_stmt().
Referenced by n_of_executions_at_most().
Substitute value VAL for ssa name NAME inside expressions held at LOOP.
References loop::nb_iterations, and simplify_replace_tree().
Referenced by replace_uses_by().