GCC Middle and Back End API Reference
tree-ssa-loop-manip.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "cfghooks.h"
#include "tree-pass.h"
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "fold-const.h"
#include "cfganal.h"
#include "gimplify.h"
#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "tree-cfg.h"
#include "tree-ssa-loop-ivopts.h"
#include "tree-ssa-loop-manip.h"
#include "tree-ssa-loop-niter.h"
#include "tree-ssa-loop.h"
#include "tree-into-ssa.h"
#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-scalar-evolution.h"
#include "tree-inline.h"
Include dependency graph for tree-ssa-loop-manip.cc:




void create_iv (tree base, tree_code incr_op, tree step, tree var, class loop *loop, gimple_stmt_iterator *incr_pos, bool after, tree *var_before, tree *var_after)
static class loopfind_sibling_superloop (class loop *use_loop, class loop *def_loop)
static void compute_live_loop_exits (bitmap live_exits, bitmap use_blocks, basic_block def_bb, bitmap def_loop_exits)
static void add_exit_phi (basic_block exit, tree var)
static unsigned add_exit_phis_var (tree var, bitmap use_blocks, bitmap def_loop_exits)
static int loop_name_cmp (const void *p1, const void *p2)
static bool add_exit_phis (bitmap names_to_rename, bitmap *use_blocks)
static void find_uses_to_rename_use (basic_block bb, tree use, bitmap *use_blocks, bitmap need_phis)
static void find_uses_to_rename_stmt (gimple *stmt, bitmap *use_blocks, bitmap need_phis, int use_flags)
static void find_uses_to_rename_bb (basic_block bb, bitmap *use_blocks, bitmap need_phis, int use_flags)
static void find_uses_to_rename (bitmap changed_bbs, bitmap *use_blocks, bitmap need_phis, int use_flags)
static void rewrite_into_loop_closed_ssa_1 (bitmap changed_bbs, unsigned update_flag, int use_flags)
void rewrite_into_loop_closed_ssa (bitmap changed_bbs, unsigned update_flag)
static void check_loop_closed_ssa_def (basic_block def_bb, tree def)
static void check_loop_closed_ssa_bb (basic_block bb)
DEBUG_FUNCTION void verify_loop_closed_ssa (bool verify_ssa_p, class loop *loop)
basic_block split_loop_exit_edge (edge exit, bool copy_constants_p)
basic_block ip_end_pos (class loop *loop)
basic_block ip_normal_pos (class loop *loop)
void standard_iv_increment_position (class loop *loop, gimple_stmt_iterator *bsi, bool *insert_after)
static void copy_phi_node_args (unsigned first_new_block)
bool gimple_duplicate_loop_body_to_header_edge (class loop *loop, edge e, unsigned int ndupl, sbitmap wont_exit, edge orig, vec< edge > *to_remove, int flags)
bool can_unroll_loop_p (class loop *loop, unsigned factor, class tree_niter_desc *niter)
static void determine_exit_conditions (class loop *loop, class tree_niter_desc *desc, unsigned factor, tree *enter_cond, tree *exit_base, tree *exit_step, enum tree_code *exit_cmp, tree *exit_bound)
void tree_transform_and_unroll_loop (class loop *loop, unsigned factor, class tree_niter_desc *desc, transform_callback transform, void *data)
void tree_unroll_loop (class loop *loop, unsigned factor, class tree_niter_desc *desc)
static void rewrite_phi_with_iv (loop_p loop, gphi_iterator *psi, gimple_stmt_iterator *gsi, tree main_iv)
static void rewrite_all_phi_nodes_with_iv (loop_p loop, tree main_iv)
tree canonicalize_loop_ivs (class loop *loop, tree *nit, bool bump_in_latch)


static bitmap_obstack loop_renamer_obstack

Macro Definition Documentation


Unroll LOOP FACTOR times.  LOOP is known to have a single exit edge
whose source block dominates the latch.  DESC describes the number of
iterations of LOOP.

If N is number of iterations of the loop and MAY_BE_ZERO is the condition
under that loop exits in the first iteration even if N != 0,

while (1)
    x = phi (init, next);

    if (st)

becomes (with possibly the exit conditions formulated a bit differently,
avoiding the need to create a new iv):

  goto rest;

    x = phi (init, next);

    N -= FACTOR;

  } while (N >= FACTOR);

  init' = phi (init, x);

while (1)
    x = phi (init', next);

    if (st)

Before the loop is unrolled, TRANSFORM is called for it (only for the
unrolled loop, but not for its versioned copy).  DATA is passed to
Probability in % that the unrolled loop is entered.  Just a guess.   

Referenced by tree_transform_and_unroll_loop().

Function Documentation

◆ add_exit_phi()

◆ add_exit_phis()

static bool add_exit_phis ( bitmap names_to_rename,
bitmap * use_blocks )
Add exit phis for the names marked in NAMES_TO_RENAME.
Exits of the loops are stored in EXITS.  Sets of blocks where the ssa
names are used are stored in USE_BLOCKS.  Returns whether any name
required multiple LC PHI nodes.   

References add_exit_phis_var(), bitmap_clear(), bitmap_count_bits(), bitmap_set_bit, cfun, current_loops, EXECUTE_IF_SET_IN_BITMAP, loop::exits, get_loop(), gimple_bb(), i, basic_block_def::loop_father, loop_name_cmp(), loop_outer(), loop_renamer_obstack, names, loop_exit::next, NULL, ssa_name, and SSA_NAME_DEF_STMT.

Referenced by rewrite_into_loop_closed_ssa_1().

◆ add_exit_phis_var()

static unsigned add_exit_phis_var ( tree var,
bitmap use_blocks,
bitmap def_loop_exits )
Add exit phis for VAR that is used in LIVEIN.
Exits of the loops are stored in LOOP_EXITS.  Returns the number
of PHIs added for VAR.   

References add_exit_phi(), BASIC_BLOCK_FOR_FN, bitmap_bit_p, cfun, compute_live_loop_exits(), EXECUTE_IF_SET_IN_BITMAP, gcc_checking_assert, gimple_bb(), basic_block_def::index, loop_renamer_obstack, and SSA_NAME_DEF_STMT.

Referenced by add_exit_phis().

◆ can_unroll_loop_p()

◆ canonicalize_loop_ivs()

tree canonicalize_loop_ivs ( class loop * loop,
tree * nit,
bool bump_in_latch )
Bases all the induction variables in LOOP on a single induction variable
(with base 0 and step 1), whose final value is compared with *NIT.  When the
IV type precision has to be larger than *NIT type precision, *NIT is
converted to the larger type, the conversion code is inserted before the
loop, and *NIT is updated to the new definition.  When BUMP_IN_LATCH is true,
the induction variable is incremented in the loop latch, otherwise it is
incremented in the loop header.  Return the induction variable that was

References as_a(), build_int_cst(), build_int_cst_type(), build_nonstandard_integer_type(), create_iv(), extract_true_false_edges_from_block(), fold_convert, force_gimple_operand(), GET_MODE_PRECISION(), gimple_cond_set_code(), gimple_cond_set_lhs(), gimple_cond_set_rhs(), gsi_end_p(), gsi_insert_seq_on_edge_immediate(), gsi_last_bb(), gsi_last_nondebug_bb(), gsi_next(), gsi_start_phis(), loop::header, INTEGRAL_TYPE_P, loop::latch, loop_preheader_edge(), NULL, NULL_TREE, gphi_iterator::phi(), PHI_RESULT, POINTER_TYPE_P, rewrite_all_phi_nodes_with_iv(), single_dom_exit(), smallest_int_mode_for_size(), TREE_TYPE, type(), TYPE_PRECISION, TYPE_UNSIGNED, update_stmt(), and virtual_operand_p().

Referenced by gen_parallel_loop().

◆ check_loop_closed_ssa_bb()

static void check_loop_closed_ssa_bb ( basic_block bb)

◆ check_loop_closed_ssa_def()

static void check_loop_closed_ssa_def ( basic_block def_bb,
tree def )

◆ compute_live_loop_exits()

static void compute_live_loop_exits ( bitmap live_exits,
bitmap use_blocks,
basic_block def_bb,
bitmap def_loop_exits )
DEF_BB is a basic block containing a DEF that needs rewriting into
loop-closed SSA form.  USE_BLOCKS is the set of basic blocks containing
uses of DEF that "escape" from the loop containing DEF_BB (i.e. blocks in
USE_BLOCKS are dominated by DEF_BB but not in the loop father of DEF_BB).
ALL_EXITS[I] is the set of all basic blocks that exit loop I.
DEF_LOOP_EXITS is a bitmap of loop exit blocks that exit the loop
containing DEF_BB or its outer loops.

Compute the subset of loop exit destinations that exit the loop
containing DEF_BB or one of its loop fathers, in which DEF is live.
This set is returned in the bitmap LIVE_EXITS.

Instead of computing the complete livein set of the def, we use the loop
nesting tree as a form of poor man's structure analysis.  This greatly
speeds up the analysis, which is important because this function may be
called on all SSA names that need rewriting, one at a time.   

References BASIC_BLOCK_FOR_FN, bitmap_and_into(), bitmap_set_bit, CDI_DOMINATORS, cfun, dominated_by_p(), EDGE_COUNT, ENTRY_BLOCK_PTR_FOR_FN, EXECUTE_IF_SET_IN_BITMAP, find_sibling_superloop(), flow_loop_nested_p(), FOR_EACH_EDGE, gcc_assert, gcc_checking_assert, loop::header, i, basic_block_def::index, loop_depth(), basic_block_def::loop_father, MAX, n_basic_blocks_for_fn, basic_block_def::preds, superloop_at_depth(), and worklist.

Referenced by add_exit_phis_var().

◆ copy_phi_node_args()

static void copy_phi_node_args ( unsigned first_new_block)
Copies phi node arguments for duplicated blocks.  The index of the first
duplicated block is FIRST_NEW_BLOCK.   

References add_phi_args_after_copy_bb(), BASIC_BLOCK_FOR_FN, cfun, i, and last_basic_block_for_fn.

Referenced by gimple_duplicate_loop_body_to_header_edge().

◆ create_iv()

void create_iv ( tree base,
tree_code incr_op,
tree step,
tree var,
class loop * loop,
gimple_stmt_iterator * incr_pos,
bool after,
tree * var_before,
tree * var_after )
Creates an induction variable with value BASE (+/-) STEP * iteration in LOOP.
If INCR_OP is PLUS_EXPR, the induction variable is BASE + STEP * iteration.
If INCR_OP is MINUS_EXPR, the induction variable is BASE - STEP * iteration.
It is expected that neither BASE nor STEP are shared with other expressions
(unless the sharing rules allow this).  Use VAR as a base var_decl for it
(if NULL, a new temporary will be created).  The increment will occur at
INCR_POS (after it if AFTER is true, before it otherwise).  INCR_POS and
AFTER can be computed using standard_iv_increment_position.  The ssa versions
of the variable before and after increment will be stored in VAR_BEFORE and
VAR_AFTER (unless they are NULL).   

References add_phi_arg(), convert_to_ptrofftype, create_phi_node(), fold_build1, force_gimple_operand(), gcc_assert, gimple_build_assign(), gimple_location(), gimple_set_location(), gsi_bb(), gsi_end_p(), gsi_insert_after(), gsi_insert_before(), gsi_insert_seq_on_edge_immediate(), GSI_NEW_STMT, gsi_next_nondebug(), gsi_stmt(), loop::header, is_gimple_debug(), loop_latch_edge(), loop_preheader_edge(), make_ssa_name(), make_temp_ssa_name(), mark_addressable(), may_negate_without_overflow_p(), NULL, NULL_TREE, POINTER_TYPE_P, single_succ_edge(), TREE_CODE, tree_expr_nonnegative_warnv_p, tree_int_cst_lt(), TREE_OPERAND, TREE_TYPE, TYPE_UNSIGNED, and UNKNOWN_LOCATION.

Referenced by canonicalize_loop_induction_variables(), canonicalize_loop_ivs(), create_canonical_iv(), create_empty_loop_on_edge(), create_new_iv(), tree_loop_interchange::map_inductions_to_loop(), tree_transform_and_unroll_loop(), vect_create_data_ref_ptr(), vect_create_epilog_for_reduction(), vect_set_loop_condition_normal(), vect_set_loop_condition_partial_vectors_avx512(), vect_set_loop_controls_directly(), vectorizable_load(), and vectorizable_store().

◆ determine_exit_conditions()

static void determine_exit_conditions ( class loop * loop,
class tree_niter_desc * desc,
unsigned factor,
tree * enter_cond,
tree * exit_base,
tree * exit_step,
enum tree_code * exit_cmp,
tree * exit_bound )
Determines the conditions that control execution of LOOP unrolled FACTOR
times.  DESC is number of iterations of LOOP.  ENTER_COND is set to
condition that must be true if the main loop can be entered.
If the loop does not always iterate an exact multiple of FACTOR times,
EXIT_BASE, EXIT_STEP, EXIT_CMP and EXIT_BOUND are set to values describing
how the exit from the unrolled loop should be controlled.  Otherwise,
the trees are set to null and EXIT_CMP is set to ERROR_MARK.   

References affine_iv::base, boolean_false_node, boolean_true_node, boolean_type_node, tree_niter_desc::bound, build_int_cst(), build_int_cst_type(), build_one_cst(), tree_niter_desc::cmp, tree_niter_desc::control, fold_build2, fold_convert, force_gimple_operand(), gcc_assert, gcc_unreachable, gsi_insert_seq_on_edge_immediate(), integer_nonzerop(), integer_zerop(), invert_truthvalue, is_gimple_condexpr_for_cond(), loop_preheader_edge(), lower_bound_in_type(), tree_niter_desc::may_be_zero, multiple_of_p(), tree_niter_desc::niter, NULL_TREE, affine_iv::step, tree_int_cst_sign_bit(), TREE_TYPE, unshare_expr(), and upper_bound_in_type().

Referenced by tree_transform_and_unroll_loop().

◆ find_sibling_superloop()

static class loop * find_sibling_superloop ( class loop * use_loop,
class loop * def_loop )
Return the innermost superloop LOOP of USE_LOOP that is a superloop of
both DEF_LOOP and USE_LOOP.   

References gcc_assert, loop_depth(), loop_outer(), and superloop_at_depth().

Referenced by compute_live_loop_exits().

◆ find_uses_to_rename()

static void find_uses_to_rename ( bitmap changed_bbs,
bitmap * use_blocks,
bitmap need_phis,
int use_flags )
Marks names matching USE_FLAGS that are used outside of the loop they are
defined in for rewrite.  Records the set of blocks in which the ssa names are
used to USE_BLOCKS.  Record the SSA names that will need exit PHIs in
NEED_PHIS.  If CHANGED_BBS is not NULL, scan only blocks in this set.   

References BASIC_BLOCK_FOR_FN, cfun, EXECUTE_IF_SET_IN_BITMAP, find_uses_to_rename_bb(), and FOR_EACH_BB_FN.

Referenced by rewrite_into_loop_closed_ssa_1().

◆ find_uses_to_rename_bb()

static void find_uses_to_rename_bb ( basic_block bb,
bitmap * use_blocks,
bitmap need_phis,
int use_flags )
Marks names matching USE_FLAGS that are used in BB and outside of the loop
they are defined in for rewrite.  Records the set of blocks in which the ssa
names are used to USE_BLOCKS.  Record the SSA names that will
need exit PHIs in NEED_PHIS.   

References find_uses_to_rename_stmt(), find_uses_to_rename_use(), FOR_EACH_EDGE, gimple_phi_result(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), PHI_ARG_DEF_FROM_EDGE, SSA_OP_USE, SSA_OP_VIRTUAL_USES, basic_block_def::succs, and virtual_operand_p().

Referenced by find_uses_to_rename().

◆ find_uses_to_rename_stmt()

static void find_uses_to_rename_stmt ( gimple * stmt,
bitmap * use_blocks,
bitmap need_phis,
int use_flags )
For uses matching USE_FLAGS in STMT, mark names that are used outside of the
loop they are defined to rewrite.  Record the set of blocks in which the ssa
names are used to USE_BLOCKS, and the ssa names themselves to NEED_PHIS.   

References find_uses_to_rename_use(), FOR_EACH_SSA_TREE_OPERAND, gimple_bb(), gimple_vuse(), is_gimple_debug(), NULL_TREE, and SSA_OP_VIRTUAL_USES.

Referenced by find_uses_to_rename_bb().

◆ find_uses_to_rename_use()

static void find_uses_to_rename_use ( basic_block bb,
tree use,
bitmap * use_blocks,
bitmap need_phis )
For USE in BB, if it is used outside of the loop it is defined in,
mark it for rewrite.  Record basic block BB where it is used
to USE_BLOCKS.  Record the ssa name index to NEED_PHIS bitmap.
Note that for USEs in phis, BB should be the src of the edge corresponding to
the use, rather than the bb containing the phi.   

References BITMAP_ALLOC, bitmap_set_bit, flow_bb_inside_loop_p(), gimple_bb(), basic_block_def::index, basic_block_def::loop_father, loop_outer(), loop_renamer_obstack, SSA_NAME_DEF_STMT, SSA_NAME_VERSION, and TREE_CODE.

Referenced by find_uses_to_rename_bb(), and find_uses_to_rename_stmt().

◆ gimple_duplicate_loop_body_to_header_edge()

bool gimple_duplicate_loop_body_to_header_edge ( class loop * loop,
edge e,
unsigned int ndupl,
sbitmap wont_exit,
edge orig,
vec< edge > * to_remove,
int flags )
The same as cfgloopmanip.cc:duplicate_loop_body_to_header_edge, but also
updates the PHI nodes at start of the copied region.  In order to
achieve this, only loops whose exits all lead to the same location
are handled.

Notice that we do not completely update the SSA web after
duplication.  The caller is responsible for calling update_ssa
after the loop has been duplicated.   

References cfun, copy_phi_node_args(), duplicate_loop_body_to_header_edge(), flush_pending_stmts(), last_basic_block_for_fn, LOOPS_HAVE_PREHEADERS, LOOPS_HAVE_SIMPLE_LATCHES, loops_state_satisfies_p(), and scev_reset().

Referenced by tree_transform_and_unroll_loop(), try_peel_loop(), and try_unroll_loop_completely().

◆ ip_end_pos()

basic_block ip_end_pos ( class loop * loop)
Returns the basic block in that statements should be emitted for induction
variables incremented at the end of the LOOP.   

References loop::latch.

Referenced by add_candidate(), add_iv_candidate_derived_from_uses(), allow_ip_end_pos_p(), create_new_iv(), determine_iv_cost(), and standard_iv_increment_position().

◆ ip_normal_pos()

basic_block ip_normal_pos ( class loop * loop)
Returns the basic block in that statements should be emitted for induction
variables incremented just before exit condition of a LOOP.   

References EDGE_SUCC, flow_bb_inside_loop_p(), gsi_last_bb(), loop::latch, NULL, safe_is_a(), single_pred(), and single_pred_p().

Referenced by add_candidate(), add_iv_candidate_derived_from_uses(), allow_ip_end_pos_p(), create_new_iv(), standard_iv_increment_position(), and stmt_after_ip_normal_pos().

◆ loop_name_cmp()

static int loop_name_cmp ( const void * p1,
const void * p2 )

Referenced by add_exit_phis().

◆ rewrite_all_phi_nodes_with_iv()

static void rewrite_all_phi_nodes_with_iv ( loop_p loop,
tree main_iv )
Rewrite all the phi nodes of LOOP in function of the main induction
variable MAIN_IV.   

References free(), get_loop_body_in_dom_order(), gsi_after_labels(), gsi_end_p(), gsi_start_phis(), i, basic_block_def::loop_father, loop::num_nodes, and rewrite_phi_with_iv().

Referenced by canonicalize_loop_ivs().

◆ rewrite_into_loop_closed_ssa()

void rewrite_into_loop_closed_ssa ( bitmap changed_bbs,
unsigned update_flag )
Rewrites the defs and uses into a loop closed ssa form.
If CHANGED_BBS is not NULL, we look for uses outside loops only in the basic
blocks in this set.  UPDATE_FLAG is used in the call to update_ssa.  See
TODO_update_ssa* for documentation.   

References rewrite_into_loop_closed_ssa_1(), and SSA_OP_ALL_USES.

Referenced by canonicalize_induction_variables(), loop_distribution::execute(), execute_ranger_vrp(), execute_update_addresses_taken(), loop_invariant_motion_in_fun(), repair_loop_structures(), tree_loop_unroll_and_jam(), tree_predictive_commoning(), tree_ssa_prefetch_arrays(), tree_ssa_split_loops(), and tree_unroll_loops_completely().

◆ rewrite_into_loop_closed_ssa_1()

static void rewrite_into_loop_closed_ssa_1 ( bitmap changed_bbs,
unsigned update_flag,
int use_flags )
Rewrites the program into a loop closed ssa form -- i.e. inserts extra
phi nodes to ensure that no variable is used outside the loop it is
defined in.

This strengthening of the basic ssa form has several advantages:

1) Updating it during unrolling/peeling/versioning is trivial, since
   we do not need to care about the uses outside of the loop.
   The same applies to virtual operands which are also rewritten into
   loop closed SSA form.  Note that virtual operands are always live
   until function exit.
2) The behavior of all uses of an induction variable is the same.
   Without this, you need to distinguish the case when the variable
   is used outside of the loop it is defined in, for example

   for (i = 0; i < 100; i++)
       for (j = 0; j < 100; j++)
           k = i + j;
           use1 (k);
       use2 (k);

   Looking from the outer loop with the normal SSA form, the first use of k
   is not well-behaved, while the second one is an induction variable with
   base 99 and step 1.

   If CHANGED_BBS is not NULL, we look for uses outside loops only in the
   basic blocks in this set.

   USE_FLAGS allows us to specify whether we want virtual, non-virtual or
   both variables rewritten.

   UPDATE_FLAG is used in the call to update_ssa.  See
   TODO_update_ssa* for documentation.   

References add_exit_phis(), BITMAP_ALLOC, bitmap_empty_p(), bitmap_obstack_initialize(), bitmap_obstack_release(), cfun, find_uses_to_rename(), free(), LOOP_CLOSED_SSA, loop_renamer_obstack, LOOPS_HAVE_RECORDED_EXITS, loops_state_satisfies_p(), loops_state_set(), num_ssa_names, number_of_loops(), record_loop_exits(), release_recorded_exits(), TODO_update_ssa, TODO_update_ssa_no_phi, update_ssa(), and verify_ssa().

Referenced by rewrite_into_loop_closed_ssa().

◆ rewrite_phi_with_iv()

static void rewrite_phi_with_iv ( loop_p loop,
gphi_iterator * psi,
gimple_stmt_iterator * gsi,
tree main_iv )
Rewrite the phi node at position PSI in function of the main
induction variable MAIN_IV and insert the generated code at GSI.   

References iv::base, fold_build2, fold_convert, force_gimple_operand_gsi(), gimple_build_assign(), gsi_insert_before(), gsi_next(), GSI_SAME_STMT, NULL_TREE, gphi_iterator::phi(), PHI_RESULT, POINTER_TYPE_P, remove_phi_node(), simple_iv(), sizetype, iv::step, TREE_TYPE, unshare_expr(), and virtual_operand_p().

Referenced by rewrite_all_phi_nodes_with_iv().

◆ split_loop_exit_edge()

basic_block split_loop_exit_edge ( edge exit,
bool copy_constants_p )
Split loop exit edge EXIT.  The things are a bit complicated by a need to
preserve the loop closed ssa form.  If COPY_CONSTANTS_P is true then
forwarder PHIs are also created for constant arguments.
The newly created block is returned.   

References add_phi_arg(), create_phi_node(), duplicate_ssa_name(), gimple_phi_arg_location_from_edge(), gsi_end_p(), gsi_next(), gsi_start_phis(), NULL, gphi_iterator::phi(), PHI_ARG_DEF_PTR_FROM_EDGE, PHI_RESULT, SET_USE, single_succ_edge(), split_edge(), TREE_CODE, and USE_FROM_PTR.

Referenced by create_parallel_loop(), emit_mfence_after_loop(), final_value_replacement_loop(), and vect_transform_loop().

◆ standard_iv_increment_position()

void standard_iv_increment_position ( class loop * loop,
gimple_stmt_iterator * bsi,
bool * insert_after )
Stores the standard position for induction variable increment in LOOP
(just before the exit condition if it is available and latch block is empty,
end of the latch block otherwise) to BSI.  INSERT_AFTER is set to true if
the increment should be inserted after *BSI.   

References gsi_last_bb(), ip_end_pos(), ip_normal_pos(), last, last_nondebug_stmt(), and loop::latch.

Referenced by vect_create_data_ref_ptr(), vectorizable_load(), and vectorizable_store().

◆ tree_transform_and_unroll_loop()

void tree_transform_and_unroll_loop ( class loop * loop,
unsigned factor,
class tree_niter_desc * desc,
transform_callback transform,
void * data )

References add_phi_arg(), profile_probability::always(), loop::any_estimate, loop::any_likely_upper_bound, loop::any_upper_bound, profile_probability::apply_scale(), as_a(), bitmap_clear_bit(), bitmap_ones(), checking_verify_flow_info(), checking_verify_loop_closed_ssa(), checking_verify_loop_structure(), copy_ssa_name(), basic_block_def::count, create_iv(), create_phi_node(), determine_exit_conditions(), DLTHE_FLAG_FLAT_PROFILE, DLTHE_FLAG_UPDATE_FREQ, gcc_assert, gimple_build_cond(), gimple_cond_set_code(), gimple_cond_set_lhs(), gimple_cond_set_rhs(), gimple_duplicate_loop_body_to_header_edge(), gsi_end_p(), gsi_insert_after(), gsi_last_bb(), gsi_last_nondebug_bb(), GSI_NEW_STMT, gsi_next(), gsi_start_phis(), gsi_stmt(), profile_probability::guessed_always(), loop::header, integer_nonzerop(), integer_zero_node, profile_probability::invert(), loop::latch, loop_latch_edge(), loop_preheader_edge(), loop_version(), make_edge(), make_temp_ssa_name(), maybe_flat_loop_profile(), loop::nb_iterations_estimate, loop::nb_iterations_likely_upper_bound, loop::nb_iterations_upper_bound, profile_probability::never(), loop::next, NULL, NULL_TREE, operand_equal_for_phi_arg_p(), PHI_ARG_DEF_FROM_EDGE, PHI_ARG_DEF_PTR_FROM_EDGE, PROB_UNROLLED_LOOP_ENTERED, remove_path(), rescan_loop_exit(), scale_dominated_blocks_in_loop(), scale_loop_profile(), set_edge_probability_and_rescale_others(), SET_USE, single_dom_exit(), single_pred(), single_pred_edge(), split_edge(), TODO_update_ssa, TODO_update_ssa_no_phi, TREE_CODE, TREE_TYPE, wi::udiv_floor(), UNKNOWN_LOCATION, update_loop_exit_probability_scale_dom_bbs(), update_ssa(), update_stmt(), USE_FROM_PTR, and useless_type_conversion_p().

Referenced by pcom_worker::tree_predictive_commoning_loop(), and tree_unroll_loop().

◆ tree_unroll_loop()

void tree_unroll_loop ( class loop * loop,
unsigned factor,
class tree_niter_desc * desc )
Wrapper over tree_transform_and_unroll_loop for case we do not
want to transform the loop before unrolling.  The meaning
of the arguments is the same as for tree_transform_and_unroll_loop.   

References NULL, and tree_transform_and_unroll_loop().

Referenced by loop_prefetch_arrays(), and tree_loop_unroll_and_jam().

◆ verify_loop_closed_ssa()

DEBUG_FUNCTION void verify_loop_closed_ssa ( bool verify_ssa_p,
class loop * loop )
Checks that invariants of the loop closed ssa form are preserved.
Call verify_ssa when VERIFY_SSA_P is true.  Note all loops are checked
if LOOP is NULL, otherwise, only LOOP is checked.   

References cfun, check_loop_closed_ssa_bb(), FOR_EACH_BB_FN, free(), gcc_assert, get_loop_body(), i, basic_block_def::loop_father, need_ssa_update_p(), NULL, loop::num, loop::num_nodes, number_of_loops(), timevar_pop(), timevar_push(), and verify_ssa().

Referenced by checking_verify_loop_closed_ssa(), execute_function_todo(), and tree_unroll_loops_completely().

Variable Documentation

◆ loop_renamer_obstack

bitmap_obstack loop_renamer_obstack
High-level loop manipulation functions.
   Copyright (C) 2004-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
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
All bitmaps for rewriting into loop-closed SSA go on this obstack,
so that we can free them all at once.   

Referenced by add_exit_phis(), add_exit_phis_var(), find_uses_to_rename_use(), and rewrite_into_loop_closed_ssa_1().