GCC Middle and Back End API Reference
tree-if-conv.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "cfghooks.h"
#include "tree-pass.h"
#include "ssa.h"
#include "expmed.h"
#include "expr.h"
#include "optabs-tree.h"
#include "gimple-pretty-print.h"
#include "alias.h"
#include "fold-const.h"
#include "stor-layout.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "gimplify.h"
#include "gimplify-me.h"
#include "tree-cfg.h"
#include "tree-into-ssa.h"
#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
#include "tree-ssa-loop.h"
#include "tree-ssa-loop-niter.h"
#include "tree-ssa-loop-ivopts.h"
#include "tree-ssa-address.h"
#include "dbgcnt.h"
#include "tree-hash-traits.h"
#include "varasm.h"
#include "builtins.h"
#include "cfganal.h"
#include "internal-fn.h"
#include "tree-ssa-sccvn.h"
#include "tree-cfgcleanup.h"
#include "tree-ssa-dse.h"
#include "tree-vectorizer.h"
#include "tree-eh.h"
#include "cgraph.h"
#include "langhooks.h"
Include dependency graph for tree-if-conv.cc:

Data Structures

struct  innermost_loop_behavior_hash
struct  bb_predicate
struct  ifc_dr
struct  ifcvt_arg_entry


#define MAX_PHI_ARG_NUM    ((unsigned) param_max_tree_if_conversion_phi_args)
#define IFC_DR(DR)   ((struct ifc_dr *) (DR)->aux)
#define DR_BASE_W_UNCONDITIONALLY(DR)   (IFC_DR (DR)->written_at_least_once)
#define DR_RW_UNCONDITIONALLY(DR)   (IFC_DR (DR)->rw_unconditionally)
#define DR_W_UNCONDITIONALLY(DR)   (IFC_DR (DR)->w_unconditionally)


typedef struct ifcvt_arg_entry ifcvt_arg_entry_t


static bool bb_has_predicate (basic_block bb)
static tree bb_predicate (basic_block bb)
static void set_bb_predicate (basic_block bb, tree cond)
static gimple_seq bb_predicate_gimplified_stmts (basic_block bb)
static void set_bb_predicate_gimplified_stmts (basic_block bb, gimple_seq stmts, bool preserve_counts)
static void add_bb_predicate_gimplified_stmts (basic_block bb, gimple_seq stmts)
static unsigned get_bb_num_predicate_stmts (basic_block bb)
static void init_bb_predicate (basic_block bb)
static void release_bb_predicate (basic_block bb)
static void free_bb_predicate (basic_block bb)
static void reset_bb_predicate (basic_block bb)
static tree ifc_temp_var (tree type, tree expr, gimple_stmt_iterator *gsi)
static bool is_false_predicate (tree cond)
static bool is_true_predicate (tree cond)
static bool is_predicated (basic_block bb)
static enum tree_code parse_predicate (tree cond, tree *op0, tree *op1)
static tree fold_or_predicates (location_t loc, tree c1, tree c2)
static tree fold_build_cond_expr (tree type, tree cond, tree rhs, tree lhs)
static void add_to_predicate_list (class loop *loop, basic_block bb, tree nc)
static void add_to_dst_predicate_list (class loop *loop, edge e, tree prev_cond, tree cond)
static bool bb_with_exit_edge_p (const class loop *loop, basic_block bb)
static bool phi_convertible_by_degenerating_args (gphi *phi)
static bool if_convertible_phi_p (class loop *loop, basic_block bb, gphi *phi)
static void hash_memrefs_baserefs_and_store_DRs_read_written_info (data_reference_p a)
static bool idx_within_array_bound (tree ref, tree *idx, void *dta)
bool ref_within_array_bound (gimple *stmt, tree ref)
static bool base_object_writable (tree ref)
static bool ifcvt_memrefs_wont_trap (gimple *stmt, vec< data_reference_p > drs)
static bool ifcvt_can_use_mask_load_store (gimple *stmt)
static bool ifcvt_can_predicate (gimple *stmt)
static bool if_convertible_gimple_assign_stmt_p (gimple *stmt, vec< data_reference_p > refs)
static bool if_convertible_stmt_p (gimple *stmt, vec< data_reference_p > refs)
static bool all_preds_critical_p (basic_block bb)
static bool if_convertible_bb_p (class loop *loop, basic_block bb, basic_block exit_bb)
static bool pred_blocks_visited_p (basic_block bb, bitmap *visited)
static basic_blockget_loop_body_in_if_conv_order (const class loop *loop)
static void predicate_bbs (loop_p loop)
static vec< basic_blockbuild_region (class loop *loop)
static bool if_convertible_loop_p_1 (class loop *loop, vec< data_reference_p > *refs)
static bool if_convertible_loop_p (class loop *loop, vec< data_reference_p > *refs)
static tree strip_nop_cond_scalar_reduction (bool has_nop, tree op)
static bool is_cond_scalar_reduction (gimple *phi, gimple **reduc, tree arg_0, tree arg_1, tree *op0, tree *op1, bool extended, bool *has_nop, gimple **nop_reduc)
static tree convert_scalar_cond_reduction (gimple *reduc, gimple_stmt_iterator *gsi, tree cond, tree op0, tree op1, bool swap, bool has_nop, gimple *nop_reduc, bool loop_versioned)
static tree gen_simplified_condition (tree cond, scalar_cond_masked_set_type &cond_set)
static tree gen_phi_arg_condition (gphi *phi, ifcvt_arg_entry_t &arg, gimple_stmt_iterator *gsi, scalar_cond_masked_set_type &cond_set, bool *invert)
static tree gen_phi_nest_statement (gphi *phi, gimple_stmt_iterator *gsi, scalar_cond_masked_set_type &cond_set, tree type, gimple **res_stmt, tree lhs0, vec< struct ifcvt_arg_entry > &args, unsigned idx)
static int cmp_arg_entry (const void *p1, const void *p2, void *)
static void predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi, bool loop_versioned)
static void predicate_all_scalar_phis (class loop *loop, bool loop_versioned)
static void insert_gimplified_predicates (loop_p loop)
static int mask_exists (int size, const vec< int > &vec)
static gimplepredicate_load_or_store (gimple_stmt_iterator *gsi, gassign *stmt, tree mask)
static tree check_redundant_cond_expr (gimple *stmt, tree op_mask, tree op_cond, tree op_lhs)
static bool value_available_p (gimple *stmt, hash_set< tree_ssa_name_hash > *ssa_names, tree value)
static gimplepredicate_rhs_code (gassign *stmt, tree mask, tree cond, hash_set< tree_ssa_name_hash > *ssa_names)
static void predicate_statements (loop_p loop)
static void remove_conditions_and_labels (loop_p loop)
static void combine_blocks (class loop *loop, bool loop_versioned)
static class loopversion_loop_for_if_conversion (class loop *loop, vec< gimple * > *preds)
static bool versionable_outer_loop_p (class loop *loop)
static bool ifcvt_split_critical_edges (class loop *loop, bool aggressive_if_conv)
static void ifcvt_local_dce (class loop *loop)
static bool ifcvt_available_on_edge_p (edge pe, tree value)
static bool ifcvt_can_hoist (class loop *loop, edge pe, gimple *stmt)
static void ifcvt_hoist_invariants (class loop *loop, edge pe)
static tree get_bitfield_rep (gassign *stmt, bool write, tree *bitpos, tree *struct_expr)
static void lower_bitfield (gassign *stmt, bool write)
static bool bitfields_to_lower_p (class loop *loop, vec< gassign * > &reads_to_lower, vec< gassign * > &writes_to_lower)
unsigned int tree_if_conversion (class loop *loop, vec< gimple * > *preds)
gimple_opt_passmake_pass_if_conversion (gcc::context *ctxt)


static bool need_to_predicate
static bool need_to_rewrite_undefined
static bool any_complicated_phi
static bool need_to_lower_bitfields
static bool need_to_ifcvt
static basic_blockifc_bbs
static hash_map< innermost_loop_behavior_hash, data_reference_p > * innermost_DR_map
static hash_map< tree_operand_hash, data_reference_p > * baseref_DR_map
static vec< std::pair< tree, tree > > redundant_ssa_names

Macro Definition Documentation


#define DR_BASE_W_UNCONDITIONALLY ( DR)    (IFC_DR (DR)->written_at_least_once)


#define DR_RW_UNCONDITIONALLY ( DR)    (IFC_DR (DR)->rw_unconditionally)


#define DR_W_UNCONDITIONALLY ( DR)    (IFC_DR (DR)->w_unconditionally)


#define IFC_DR ( DR)    ((struct ifc_dr *) (DR)->aux)


#define MAX_PHI_ARG_NUM    ((unsigned) param_max_tree_if_conversion_phi_args)
If-conversion for vectorizer.
   Copyright (C) 2004-2024 Free Software Foundation, Inc.
   Contributed by Devang Patel <dpatel@apple.com>

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

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
This pass implements a tree level if-conversion of loops.  Its
  initial goal is to help the vectorizer to vectorize loops with

  A short description of if-conversion:

    o Decide if a loop is if-convertible or not.
    o Walk all loop basic blocks in breadth first order (BFS order).
      o Remove conditional statements (at the end of basic block)
        and propagate condition into destination basic blocks'
        predicate list.
      o Replace modify expression with conditional modify expression
        using current basic block's condition.
    o Merge all basic blocks
      o Replace phi nodes with conditional modify expr
      o Merge all basic blocks into header

    Sample transformation:


    # i_23 = PHI <0(0), i_18(10)>;
    j_15 = A[i_23];
    if (j_15 > 41) goto <L1>; else goto <L17>;

    goto <bb 3> (<L3>);


    # iftmp.2_4 = PHI <0(8), 42(2)>;
    A[i_23] = iftmp.2_4;
    i_18 = i_23 + 1;
    if (i_18 <= 15) goto <L19>; else goto <L18>;

    goto <bb 1> (<L0>);



    # i_23 = PHI <0(0), i_18(10)>;
    j_15 = A[i_23];

    iftmp.2_4 = j_15 > 41 ? 42 : 0;
    A[i_23] = iftmp.2_4;
    i_18 = i_23 + 1;
    if (i_18 <= 15) goto <L19>; else goto <L18>;

    goto <bb 1> (<L0>);

For lang_hooks.types.type_for_mode.   
Only handle PHIs with no more arguments unless we are asked to by
simd pragma.   

Referenced by ifcvt_split_critical_edges().

Typedef Documentation

◆ ifcvt_arg_entry_t

Structure used to track meta-data on PHI arguments used to generate
most efficient comparison sequence to slatten a PHI node.   

Function Documentation

◆ add_bb_predicate_gimplified_stmts()

static void add_bb_predicate_gimplified_stmts ( basic_block bb,
gimple_seq stmts )
Adds the sequence of statements STMTS to the sequence of statements
of the predicate for basic block BB.   

References basic_block_def::aux, delink_stmt_imm_use(), gimple_seq_add_seq_without_update(), gimple_set_modified(), gsi_end_p(), gsi_next(), gsi_start(), and gsi_stmt().

Referenced by add_to_predicate_list().

◆ add_to_dst_predicate_list()

static void add_to_dst_predicate_list ( class loop * loop,
edge e,
tree prev_cond,
tree cond )
Add the condition COND to the previous condition PREV_COND, and add
this to the predicate list of the destination of edge E.  LOOP is
the loop to be if-converted.   

References add_to_predicate_list(), boolean_type_node, CDI_DOMINATORS, dominated_by_p(), flow_bb_inside_loop_p(), fold_build2, ggc_alloc(), is_true_predicate(), and loop::latch.

Referenced by predicate_bbs().

◆ add_to_predicate_list()

static void add_to_predicate_list ( class loop * loop,
basic_block bb,
tree nc )
Add condition NC to the predicate list of basic block BB.  LOOP is
the loop to be if-converted. Use predicate of cd-equivalent block
for join bb if it exists: we call basic blocks bb1 and bb2 
cd-equivalent if they are executed under the same condition.   

References add_bb_predicate_gimplified_stmts(), bb_predicate(), CDI_DOMINATORS, CDI_POST_DOMINATORS, dominated_by_p(), dump_file, dump_flags, EXPR_LOCATION, flow_bb_inside_loop_p(), fold_or_predicates(), force_gimple_operand(), gcc_assert, get_immediate_dominator(), ggc_alloc(), loop::header, basic_block_def::index, is_gimple_val(), is_predicated(), is_true_predicate(), loop::latch, NULL_TREE, reset_bb_predicate(), set_bb_predicate(), TDF_DETAILS, TREE_CODE, and TREE_OPERAND.

Referenced by add_to_dst_predicate_list(), and predicate_bbs().

◆ all_preds_critical_p()

static bool all_preds_critical_p ( basic_block bb)
Assumes that BB has more than 1 predecessors.
Returns false if at least one successor is not on critical edge
and true otherwise.   

References EDGE_COUNT, FOR_EACH_EDGE, and basic_block_def::preds.

Referenced by ifcvt_split_critical_edges().

◆ base_object_writable()

static bool base_object_writable ( tree ref)
Given a memory reference expression T, return TRUE if base object
it refers to is writable.  The base object of a memory reference
is the main object being referenced, which is returned by function

References decl_binds_to_current_def_p(), DECL_P, get_base_address(), ggc_alloc(), and TREE_READONLY.

Referenced by ifcvt_memrefs_wont_trap().

◆ bb_has_predicate()

static bool bb_has_predicate ( basic_block bb)
Returns true when the basic block BB has a predicate.   

References basic_block_def::aux, and NULL.

Referenced by free_bb_predicate(), and reset_bb_predicate().

◆ bb_predicate()

◆ bb_predicate_gimplified_stmts()

static gimple_seq bb_predicate_gimplified_stmts ( basic_block bb)
Returns the sequence of statements of the gimplification of the
predicate for basic block BB.   

References basic_block_def::aux.

Referenced by insert_gimplified_predicates(), predicate_bbs(), and release_bb_predicate().

◆ bb_with_exit_edge_p()

static bool bb_with_exit_edge_p ( const class loop * loop,
basic_block bb )

◆ bitfields_to_lower_p()

static bool bitfields_to_lower_p ( class loop * loop,
vec< gassign * > & reads_to_lower,
vec< gassign * > & writes_to_lower )

◆ build_region()

static vec< basic_block > build_region ( class loop * loop)
Build region by adding loop pre-header and post-header blocks.   

References FOR_EACH_EDGE, gcc_assert, i, ifc_bbs, loop_exit_edge_p(), loop_preheader_edge(), NULL, loop::num_nodes, basic_block_def::succs, and vNULL.

Referenced by if_convertible_loop_p_1().

◆ check_redundant_cond_expr()

static tree check_redundant_cond_expr ( gimple * stmt,
tree op_mask,
tree op_cond,
tree op_lhs )
STMT uses OP_LHS.  Check whether it is equivalent to:

  ... = OP_MASK ? OP_LHS : X;

Return X if so, otherwise return null.  OP_MASK is an SSA_NAME that is
known to have value OP_COND.   

References ggc_alloc(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs3(), gimple_assign_rhs_code(), inverse_conditions_p(), NULL_TREE, and operand_equal_p().

Referenced by predicate_rhs_code().

◆ cmp_arg_entry()

static int cmp_arg_entry ( const void * p1,
const void * p2,
void *  )
When flattening a PHI node we have a choice of which conditions to test to
for all the paths from the start of the dominator block of the BB with the
PHI node.  If the PHI node has X arguments we have to only test X - 1
conditions as the last one is implicit.  It does matter which conditions we
test first.  We should test the shortest condition first (distance here is
measures in the number of logical operators in the condition) and the
longest one last.  This allows us to skip testing the most expensive
condition.  To accomplish this we need to sort the conditions.  P1 and P2
are sorted first based on the number of logical operations (num_compares)
and then by how often they occur in the PHI node.   

References ggc_alloc().

Referenced by predicate_scalar_phi().

◆ combine_blocks()

◆ convert_scalar_cond_reduction()

static tree convert_scalar_cond_reduction ( gimple * reduc,
gimple_stmt_iterator * gsi,
tree cond,
tree op0,
tree op1,
bool swap,
bool has_nop,
gimple * nop_reduc,
bool loop_versioned )
Converts conditional scalar reduction into unconditional form, e.g.
     if (_5 != 0) goto bb_5 else goto bb_6
     res_6 = res_13 + 1;
     # res_2 = PHI <res_13(4), res_6(5)>

 will be converted into sequence
  _ifc__1 = _5 != 0 ? 1 : 0;
  res_2 = res_13 + _ifc__1;
Argument SWAP tells that arguments of conditional expression should be
If LOOP_VERSIONED is true if we assume that we versioned the loop for
vectorization.  In that case we can create a COND_OP.
Returns rhs of resulting PHI assignment.   

References dump_file, dump_flags, fold_build_cond_expr(), get_conditional_internal_fn(), ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_build(), gimple_build_assign(), gimple_build_call_internal(), gimple_call_set_lhs(), gimple_convert(), gsi_for_stmt(), gsi_insert_before(), gsi_insert_seq_before(), gsi_remove(), GSI_SAME_STMT, IFN_LAST, make_temp_ssa_name(), neutral_op_for_reduction(), NULL, print_gimple_stmt(), release_defs(), TDF_DETAILS, TDF_SLIM, TREE_TYPE, unshare_expr(), and vectorized_internal_fn_supported_p().

Referenced by predicate_scalar_phi().

◆ fold_build_cond_expr()

static tree fold_build_cond_expr ( tree type,
tree cond,
tree rhs,
tree lhs )
Returns either a COND_EXPR or the folded expression if the folded
expression is a MIN_EXPR, a MAX_EXPR, an ABS_EXPR,
a constant or a SSA_NAME.  

References build1(), build2(), build3(), follow_all_ssa_edges(), ggc_alloc(), gimple_simplified_result_is_gimple_val(), integer_zerop(), NULL, TREE_CODE, TREE_OPERAND, TREE_TYPE, and gimple_match_cond::UNCOND.

Referenced by convert_scalar_cond_reduction(), gen_phi_nest_statement(), predicate_scalar_phi(), and predicate_statements().

◆ fold_or_predicates()

static tree fold_or_predicates ( location_t loc,
tree c1,
tree c2 )

◆ free_bb_predicate()

static void free_bb_predicate ( basic_block bb)
Free the predicate of basic block BB.   

References basic_block_def::aux, bb_has_predicate(), free(), NULL, and release_bb_predicate().

Referenced by combine_blocks(), and tree_if_conversion().

◆ gen_phi_arg_condition()

static tree gen_phi_arg_condition ( gphi * phi,
ifcvt_arg_entry_t & arg,
gimple_stmt_iterator * gsi,
scalar_cond_masked_set_type & cond_set,
bool * invert )

◆ gen_phi_nest_statement()

static tree gen_phi_nest_statement ( gphi * phi,
gimple_stmt_iterator * gsi,
scalar_cond_masked_set_type & cond_set,
tree type,
gimple ** res_stmt,
tree lhs0,
vec< struct ifcvt_arg_entry > & args,
unsigned idx )
Create the smallest nested conditional possible.  On pre-order we record
 which conditionals are live, and on post-order rewrite the chain by removing
 already active conditions.

 As an example we simplify:

_7 = a_10 < 0;
_21 = a_10 >= 0;
_22 = a_10 < e_11(D);
_23 = _21 & _22;
_ifc__42 = _23 ? t_13 : 0;
t_6 = _7 ? 1 : _ifc__42


_7 = a_10 < 0;
_22 = a_10 < e_11(D);
_ifc__42 = _22 ? t_13 : 0;
t_6 = _7 ? 1 : _ifc__42;

which produces better code.   

References fold_build_cond_expr(), gen_phi_arg_condition(), gen_phi_nest_statement(), ggc_alloc(), gimple_build_assign(), gsi_insert_before(), GSI_SAME_STMT, make_temp_ssa_name(), NULL, unshare_expr(), and update_stmt().

Referenced by gen_phi_nest_statement(), and predicate_scalar_phi().

◆ gen_simplified_condition()

◆ get_bb_num_predicate_stmts()

static unsigned get_bb_num_predicate_stmts ( basic_block bb)
Return the number of statements the predicate of the basic block consists

References basic_block_def::aux.

Referenced by predicate_scalar_phi().

◆ get_bitfield_rep()

static tree get_bitfield_rep ( gassign * stmt,
bool write,
tree * bitpos,
tree * struct_expr )
Returns the DECL_FIELD_BIT_OFFSET of the bitfield accesse in stmt iff its
type mode is not BLKmode.  If BITPOS is not NULL it will hold the poly_int64
value of the DECL_FIELD_BIT_OFFSET of the bitfield access and STRUCT_EXPR,
if not NULL, will hold the tree representing the base struct of this

References bitsizetype, build_int_cst(), compare_tree_int(), component_ref_field_offset(), DECL_BIT_FIELD_REPRESENTATIVE, DECL_FIELD_BIT_OFFSET, DECL_FIELD_OFFSET, DECL_SIZE, dump_file, dump_flags, fold_build2, ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs1(), is_gimple_reg_type(), NULL_TREE, TDF_DETAILS, TREE_CODE, TREE_OPERAND, TREE_TYPE, and TYPE_PRECISION.

Referenced by bitfields_to_lower_p(), and lower_bitfield().

◆ get_loop_body_in_if_conv_order()

static basic_block * get_loop_body_in_if_conv_order ( const class loop * loop)
Get body of a LOOP in suitable order for if-conversion.  It is
caller's responsibility to deallocate basic block list.
If-conversion suitable order is, breadth first sort (BFS) order
with an additional constraint: select a block only if all its
predecessors are already selected.   

References bb_with_exit_edge_p(), BITMAP_ALLOC, bitmap_bit_p, BITMAP_FREE, bitmap_set_bit, cfun, DECL_NONLOCAL, EXIT_BLOCK_PTR_FOR_FN, basic_block_def::flags, FORCED_LABEL, free(), gcc_assert, get_loop_body_in_bfs_order(), ggc_alloc(), gimple_label_label(), gimple_set_uid(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), loop::header, basic_block_def::index, loop::latch, NULL, loop::num_nodes, pred_blocks_visited_p(), and visited.

Referenced by tree_if_conversion().

◆ hash_memrefs_baserefs_and_store_DRs_read_written_info()

static void hash_memrefs_baserefs_and_store_DRs_read_written_info ( data_reference_p a)
Iterates over DR's and stores refs, DR and base refs, DR pairs in
HASH tables.  While storing them in HASH table, it checks if the
reference is unconditionally read or written and stores that as a flag
information.  For base reference it checks if it is written atlest once
unconditionally and stores it as flag information along with DR.
In other words for every data reference A in STMT there exist other
accesses to a data reference with the same base with predicates that
add up (OR-up) to the true predicate: this ensures that the data
reference A is touched (read or written) on every iteration of the
if-converted loop.   

References a, baseref_DR_map, bb_predicate(), DR_BASE_OBJECT, DR_BASE_W_UNCONDITIONALLY, DR_INNERMOST, DR_IS_WRITE, DR_RW_UNCONDITIONALLY, DR_STMT, DR_W_UNCONDITIONALLY, fold_or_predicates(), ggc_alloc(), gimple_bb(), IFC_DR, innermost_DR_map, is_true_predicate(), and UNKNOWN_LOCATION.

Referenced by if_convertible_loop_p_1().

◆ idx_within_array_bound()

static bool idx_within_array_bound ( tree ref,
tree * idx,
void * dta )

◆ if_convertible_bb_p()

static bool if_convertible_bb_p ( class loop * loop,
basic_block bb,
basic_block exit_bb )
Return true when BB is if-convertible.  This routine does not check
basic block's statements and phis.

A basic block is not if-convertible if:
- it is non-empty and it is after the exit block (in BFS order),
- it is after the exit block but before the latch,
- its edges are not normal.

EXIT_BB is the basic block containing the exit of the LOOP.  BB is
inside LOOP.   

References CDI_DOMINATORS, dominated_by_p(), dump_file, dump_flags, EDGE_COUNT, empty_block_p(), FOR_EACH_EDGE, ggc_alloc(), gimple_call_ctrl_altering_p(), gsi_last_bb(), basic_block_def::index, loop::latch, basic_block_def::succs, and TDF_DETAILS.

Referenced by if_convertible_loop_p_1().

◆ if_convertible_gimple_assign_stmt_p()

◆ if_convertible_loop_p()

static bool if_convertible_loop_p ( class loop * loop,
vec< data_reference_p > * refs )
Return true when LOOP is if-convertible.
LOOP is if-convertible if:
- it is innermost,
- it has two or more basic blocks,
- it has only one exit,
- loop header is not the exit edge,
- if its basic blocks and phi nodes are if convertible.   

References baseref_DR_map, dump_file, dump_flags, FOR_EACH_EDGE, ggc_alloc(), loop::header, if_convertible_loop_p_1(), loop::inner, innermost_DR_map, loop_exit_edge_p(), NULL, loop::num_nodes, refs, basic_block_def::succs, and TDF_DETAILS.

Referenced by tree_if_conversion().

◆ if_convertible_loop_p_1()

◆ if_convertible_phi_p()

static bool if_convertible_phi_p ( class loop * loop,
basic_block bb,
gphi * phi )
Return true when PHI is if-convertible.  PHI is part of loop LOOP
and it belongs to basic block BB.  Note at this point, it is sure
that PHI is if-convertible.  This function updates global variable
ANY_COMPLICATED_PHI if PHI is complicated.   

References any_complicated_phi, dump_file, dump_flags, ggc_alloc(), gimple_phi_num_args(), loop::header, phi_convertible_by_degenerating_args(), print_gimple_stmt(), TDF_DETAILS, and TDF_SLIM.

Referenced by if_convertible_loop_p_1().

◆ if_convertible_stmt_p()

static bool if_convertible_stmt_p ( gimple * stmt,
vec< data_reference_p > refs )
Return true when STMT is if-convertible.

A statement is if-convertible if:
- it is an if-convertible GIMPLE_ASSIGN,
- it is builtins call,
- it is a call to a function with a SIMD clone.   

References CFN_LAST, dump_file, dump_flags, ECF_CONST, ECF_LOOPING_CONST_OR_PURE, cgraph_node::get(), GF_PLF_2, ggc_alloc(), gimple_call_combined_fn(), gimple_call_flags(), gimple_call_fndecl(), gimple_set_plf(), if_convertible_gimple_assign_stmt_p(), need_to_predicate, NULL, print_gimple_stmt(), refs, cgraph_node::simd_clones, TDF_DETAILS, and TDF_SLIM.

Referenced by if_convertible_loop_p_1().

◆ ifc_temp_var()

static tree ifc_temp_var ( tree type,
tree expr,
gimple_stmt_iterator * gsi )
Returns a new SSA_NAME of type TYPE that is assigned the value of
the expression EXPR.  Inserts the statement created for this
computation before GSI and leaves the iterator GSI at the same

References gimple_build_assign(), gimple_set_vuse(), gimple_vuse(), gsi_insert_before(), GSI_SAME_STMT, gsi_stmt(), make_temp_ssa_name(), and NULL.

Referenced by lower_bitfield(), and predicate_statements().

◆ ifcvt_available_on_edge_p()

static bool ifcvt_available_on_edge_p ( edge pe,
tree value )
Return true if VALUE is already available on edge PE.   

References CDI_DOMINATORS, dominated_by_p(), ggc_alloc(), gimple_bb(), is_gimple_min_invariant(), SSA_NAME_DEF_STMT, and TREE_CODE.

Referenced by ifcvt_can_hoist().

◆ ifcvt_can_hoist()

◆ ifcvt_can_predicate()

◆ ifcvt_can_use_mask_load_store()

static bool ifcvt_can_use_mask_load_store ( gimple * stmt)
Return true if STMT could be converted into a masked load or store
(conditional load or store based on a mask computed from bb predicate).   

References can_vec_mask_load_store_p(), ggc_alloc(), gimple_assign_lhs(), gimple_assign_load_p(), gimple_assign_rhs1(), gimple_store_p(), int_mode_for_mode(), is_gimple_val(), may_be_nonaddressable_p(), TREE_TYPE, TYPE_MODE, and VECTOR_MODE_P.

Referenced by ifcvt_can_predicate().

◆ ifcvt_hoist_invariants()

static void ifcvt_hoist_invariants ( class loop * loop,
edge pe )

◆ ifcvt_local_dce()

◆ ifcvt_memrefs_wont_trap()

static bool ifcvt_memrefs_wont_trap ( gimple * stmt,
vec< data_reference_p > drs )
Return true when the memory references of STMT won't trap in the
if-converted code.  There are two things that we have to check for:

- writes to memory occur to writable memory: if-conversion of
memory writes transforms the conditional memory writes into
unconditional writes, i.e. "if (cond) A[i] = foo" is transformed
into "A[i] = cond ? foo : A[i]", and as the write to memory may not
be executed at all in the original code, it may be a readonly
memory.  To check that A is not const-qualified, we check that
there exists at least an unconditional write to A in the current

- reads or writes to memory are valid memory accesses for every
iteration.  To check that the memory accesses are correctly formed
and that we are allowed to read and write in these locations, we
check that the memory accesses to be if-converted occur at every
iteration unconditionally.

Returns true for the memory reference in STMT, same memory reference
is read or written unconditionally atleast once and the base memory
reference is written unconditionally once.  This is to check reference
will not write fault.  Also retuns true if the memory reference is
unconditionally read once then we are conditionally writing to memory
which is defined as read and write and is bound to the definition
we are seeing.   

References a, base_object_writable(), baseref_DR_map, DR_BASE_ADDRESS, DR_BASE_OBJECT, DR_BASE_W_UNCONDITIONALLY, DR_INIT, DR_INNERMOST, DR_IS_READ, DR_OFFSET, DR_REF, DR_RW_UNCONDITIONALLY, DR_STEP, DR_STMT, DR_W_UNCONDITIONALLY, gcc_assert, ggc_alloc(), gimple_uid(), innermost_DR_map, NULL, and ref_within_array_bound().

Referenced by if_convertible_gimple_assign_stmt_p().

◆ ifcvt_split_critical_edges()

static bool ifcvt_split_critical_edges ( class loop * loop,
bool aggressive_if_conv )
Performs splitting of critical edges.  Skip splitting and return false
if LOOP will not be converted because:

  - LOOP is not well formed.
  - LOOP has PHI with more than MAX_PHI_ARG_NUM arguments.

Last restriction is valid only if AGGRESSIVE_IF_CONV is false.   

References all_preds_critical_p(), bb_with_exit_edge_p(), dump_file, dump_flags, EDGE_COUNT, EDGE_CRITICAL_P, FOR_EACH_EDGE, free(), get_loop_body(), ggc_alloc(), gsi_last_bb(), i, basic_block_def::index, loop::inner, loop::latch, MAX_PHI_ARG_NUM, loop::num, loop::num_nodes, phi_nodes(), basic_block_def::preds, split_edge(), basic_block_def::succs, and TDF_DETAILS.

Referenced by tree_if_conversion().

◆ init_bb_predicate()

static void init_bb_predicate ( basic_block bb)
Initializes to TRUE the predicate of basic block BB.   

References basic_block_def::aux, boolean_true_node, ggc_alloc(), NULL, set_bb_predicate(), and set_bb_predicate_gimplified_stmts().

Referenced by predicate_bbs(), and reset_bb_predicate().

◆ insert_gimplified_predicates()

static void insert_gimplified_predicates ( loop_p loop)

◆ is_cond_scalar_reduction()

static bool is_cond_scalar_reduction ( gimple * phi,
gimple ** reduc,
tree arg_0,
tree arg_1,
tree * op0,
tree * op1,
bool extended,
bool * has_nop,
gimple ** nop_reduc )
Returns true if def-stmt for phi argument ARG is simple increment/decrement
which is in predicated basic block.
In fact, the following PHI pattern is searching:
     reduc_1 = PHI <..., reduc_2>
     if (...)
       reduc_3 = ...
     reduc_2 = PHI <reduc_1, reduc_3>

ARG_0 and ARG_1 are correspondent PHI arguments.
REDUC, OP0 and OP1 contain reduction stmt and its operands.
EXTENDED is true if PHI has > 2 arguments.   

References commutative_tree_code(), CONVERT_EXPR_CODE_P, flow_bb_inside_loop_p(), FOR_EACH_EDGE, FOR_EACH_IMM_USE_FAST, ggc_alloc(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_bb(), gimple_has_volatile_ops(), has_single_use(), loop::header, is_gimple_assign(), is_gimple_debug(), is_predicated(), basic_block_def::loop_father, loop_latch_edge(), NULL, PHI_ARG_DEF_FROM_EDGE, PHI_RESULT, SSA_NAME_DEF_STMT, strip_nop_cond_scalar_reduction(), TREE_CODE, and USE_STMT.

Referenced by predicate_scalar_phi().

◆ is_false_predicate()

static bool is_false_predicate ( tree cond)
Return true when COND is a false predicate.   

References boolean_false_node, integer_zerop(), and NULL_TREE.

Referenced by predicate_statements().

◆ is_predicated()

static bool is_predicated ( basic_block bb)
Returns true when BB has a predicate that is not trivial: true or

References is_true_predicate().

Referenced by add_to_predicate_list(), combine_blocks(), insert_gimplified_predicates(), and is_cond_scalar_reduction().

◆ is_true_predicate()

◆ lower_bitfield()

static void lower_bitfield ( gassign * stmt,
bool write )
Lowers the bitfield described by DATA.
For a write like:

struct.bf = _1;

lower to:

__ifc_1 = struct.<representative>;
__ifc_2 = BIT_INSERT_EXPR (__ifc_1, _1, bitpos);
struct.<representative> = __ifc_2;

For a read:

_1 = struct.bf;

 lower to:

 __ifc_1 = struct.<representative>;
 _1 =  BIT_FIELD_REF (__ifc_1, bitsize, bitpos);

 where representative is a legal load that contains the bitfield value,
 bitsize is the size of the bitfield and bitpos the offset to the start of
 the bitfield within the representative.   

References bitsizetype, build3(), build_int_cst(), dump_file, dump_flags, get_bitfield_rep(), ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_build_assign(), gimple_move_vops(), gsi_for_stmt(), gsi_insert_before(), gsi_remove(), GSI_SAME_STMT, ifc_temp_var(), NULL_TREE, print_gimple_stmt(), SSA_NAME_DEF_STMT, TDF_DETAILS, TDF_SLIM, TREE_TYPE, TYPE_PRECISION, and unshare_expr().

Referenced by tree_if_conversion().

◆ make_pass_if_conversion()

gimple_opt_pass * make_pass_if_conversion ( gcc::context * ctxt)

References ggc_alloc().

◆ mask_exists()

static int mask_exists ( int size,
const vec< int > & vec )
Helper function for predicate_statements. Returns index of existent
mask if it was created for given SIZE and -1 otherwise.   

References FOR_EACH_VEC_ELT, and ggc_alloc().

Referenced by predicate_statements().

◆ parse_predicate()

◆ phi_convertible_by_degenerating_args()

static bool phi_convertible_by_degenerating_args ( gphi * phi)
Given PHI which has more than two arguments, this function checks if
it's if-convertible by degenerating its arguments.  Specifically, if
below two conditions are satisfied:

  1) Number of PHI arguments with different values equals to 2 and one
     argument has the only occurrence.
  2) The edge corresponding to the unique argument isn't critical edge.

Such PHI can be handled as PHIs have only two arguments.  For example,
below PHI:

  res = PHI <A_1(e1), A_1(e2), A_2(e3)>;

can be transformed into:

  res = (predicate of e3) ? A_2 : A_1;

Return TRUE if it is the case, FALSE otherwise.   

References EDGE_COUNT, gcc_assert, gimple_phi_arg_def(), gimple_phi_arg_edge(), gimple_phi_num_args(), i, i1, i2, NULL, and operand_equal_p().

Referenced by if_convertible_phi_p().

◆ pred_blocks_visited_p()

static bool pred_blocks_visited_p ( basic_block bb,
bitmap * visited )
Return true when all predecessor blocks of BB are visited.  The
VISITED bitmap keeps track of the visited blocks.   

References bitmap_bit_p, FOR_EACH_EDGE, basic_block_def::preds, and visited.

Referenced by get_loop_body_in_if_conv_order().

◆ predicate_all_scalar_phis()

static void predicate_all_scalar_phis ( class loop * loop,
bool loop_versioned )
Replaces in LOOP all the scalar phi nodes other than those in the
LOOP->header block with conditional modify expressions.
LOOP_VERSIONED should be true if we know that the loop was versioned for

References ggc_alloc(), gimple_phi_result(), gsi_after_labels(), gsi_end_p(), gsi_next(), gsi_start_phis(), loop::header, i, ifc_bbs, loop::num_nodes, predicate_scalar_phi(), remove_phi_node(), and virtual_operand_p().

Referenced by combine_blocks().

◆ predicate_bbs()

static void predicate_bbs ( loop_p loop)
Returns true when the analysis of the predicates for all the basic
blocks in LOOP succeeded.

predicate_bbs first allocates the predicates of the basic blocks.
These fields are then initialized with the tree expressions
representing the predicates under which a basic block is executed
in the LOOP.  As the loop->header is executed at each iteration, it
has the "true" predicate.  Other statements executed under a
condition are predicated with that condition, for example

| if (x)
|   S1;
| else
|   S2;

S1 will be predicated with "x", and
S2 will be predicated with "!x".   

References add_to_dst_predicate_list(), add_to_predicate_list(), bb_predicate(), bb_predicate_gimplified_stmts(), bb_with_exit_edge_p(), boolean_true_node, boolean_type_node, build1_loc(), build2_loc(), extract_true_false_edges_from_block(), follow_all_ssa_edges(), gcc_assert, ggc_alloc(), gimple_bb(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_location(), gsi_last_bb(), loop::header, i, ifc_bbs, init_bb_predicate(), loop::latch, NULL, NULL_TREE, loop::num_nodes, reset_bb_predicate(), single_succ(), single_succ_p(), tcc_comparison, TREE_CODE_CLASS, gimple_match_cond::UNCOND, and unshare_expr().

Referenced by if_convertible_loop_p_1().

◆ predicate_load_or_store()

◆ predicate_rhs_code()

static gimple * predicate_rhs_code ( gassign * stmt,
tree mask,
tree cond,
hash_set< tree_ssa_name_hash > * ssa_names )
Helper function for predicate_statements.  STMT is a potentially-trapping
arithmetic operation that needs to be predicated by MASK, an SSA_NAME that
has value COND.  Return a statement that does so.  SSA_NAMES is the set of
SSA names defined earlier in STMT's block.   

References check_redundant_cond_expr(), FOR_EACH_IMM_USE_STMT, get_conditional_internal_fn(), ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs_code(), gimple_build_call_internal_vec(), gimple_call_set_lhs(), gimple_call_set_nothrow(), gimple_num_ops(), gimple_op(), i, NULL_TREE, operand_equal_p(), redundant_ssa_names, targetm, TREE_TYPE, and value_available_p().

Referenced by predicate_statements().

◆ predicate_scalar_phi()

static void predicate_scalar_phi ( gphi * phi,
gimple_stmt_iterator * gsi,
bool loop_versioned )
Replace a scalar PHI node with a COND_EXPR using COND as condition.
This routine can handle PHI nodes with more than two arguments.

For example,
  S1: A = PHI <x1(1), x2(5)>
is converted into,
  S2: A = cond ? x1 : x2;

The generated code is inserted at GSI that points to the top of
basic block's statement list.
If PHI node has more than two arguments a chain of conditional
expression is produced.
LOOP_VERSIONED should be true if we know that the loop was versioned for

References analyze_scalar_evolution(), bb_predicate(), chrec_contains_undetermined(), cmp_arg_entry(), convert_scalar_cond_reduction(), degenerate_phi_result(), dump_file, dump_flags, EDGE_COUNT, EDGE_PRED, fold_build_cond_expr(), fold_stmt(), follow_all_ssa_edges(), force_gimple_operand_gsi(), gen_phi_nest_statement(), gen_simplified_condition(), get_bb_num_predicate_stmts(), ggc_alloc(), gimple_bb(), gimple_build_assign(), gimple_phi_arg_def(), gimple_phi_arg_edge(), gimple_phi_num_args(), gimple_phi_result(), gsi_for_stmt(), gsi_insert_before(), GSI_SAME_STMT, gsi_stmt(), i, is_cond_scalar_reduction(), NULL, NULL_TREE, basic_block_def::preds, print_gimple_stmt(), redundant_ssa_names, TDF_DETAILS, TDF_SLIM, TREE_CODE, TREE_OPERAND, TREE_TYPE, unshare_expr(), update_stmt(), and virtual_operand_p().

Referenced by predicate_all_scalar_phis().

◆ predicate_statements()

static void predicate_statements ( loop_p loop)
Predicate each write to memory in LOOP.

  This function transforms control flow constructs containing memory
  writes of the form:

  | for (i = 0; i < N; i++)
  |   if (cond)
  |     A[i] = expr;

  into the following form that does not contain control flow:

  | for (i = 0; i < N; i++)
  |   A[i] = cond ? expr : A[i];

  The original CFG looks like this:

  | bb_0
  |   i = 0
  | end_bb_0
  | bb_1
  |   if (i < N) goto bb_5 else goto bb_2
  | end_bb_1
  | bb_2
  |   cond = some_computation;
  |   if (cond) goto bb_3 else goto bb_4
  | end_bb_2
  | bb_3
  |   A[i] = expr;
  |   goto bb_4
  | end_bb_3
  | bb_4
  |   goto bb_1
  | end_bb_4

  insert_gimplified_predicates inserts the computation of the COND
  expression at the beginning of the destination basic block:

  | bb_0
  |   i = 0
  | end_bb_0
  | bb_1
  |   if (i < N) goto bb_5 else goto bb_2
  | end_bb_1
  | bb_2
  |   cond = some_computation;
  |   if (cond) goto bb_3 else goto bb_4
  | end_bb_2
  | bb_3
  |   cond = some_computation;
  |   A[i] = expr;
  |   goto bb_4
  | end_bb_3
  | bb_4
  |   goto bb_1
  | end_bb_4

  predicate_statements is then predicating the memory write as follows:

  | bb_0
  |   i = 0
  | end_bb_0
  | bb_1
  |   if (i < N) goto bb_5 else goto bb_2
  | end_bb_1
  | bb_2
  |   if (cond) goto bb_3 else goto bb_4
  | end_bb_2
  | bb_3
  |   cond = some_computation;
  |   A[i] = cond ? expr : A[i];
  |   goto bb_4
  | end_bb_3
  | bb_4
  |   goto bb_1
  | end_bb_4

  and finally combine_blocks removes the basic block boundaries making
  the loop vectorizable:

  | bb_0
  |   i = 0
  |   if (i < N) goto bb_5 else goto bb_1
  | end_bb_0
  | bb_1
  |   cond = some_computation;
  |   A[i] = cond ? expr : A[i];
  |   if (i < N) goto bb_5 else goto bb_4
  | end_bb_1
  | bb_4
  |   goto bb_1
  | end_bb_4

References hash_set< KeyId, Lazy, Traits >::add(), arith_code_with_undefined_signed_overflow(), bb_predicate(), boolean_type_node, COMPARISON_CLASS_P, constant_boolean_node(), hash_set< KeyId, Lazy, Traits >::empty(), fold_build_cond_expr(), force_gimple_operand_gsi(), GET_MODE_BITSIZE(), GF_PLF_2, ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_assign_set_rhs1(), gimple_assign_single_p(), gimple_build(), gimple_build_call_internal_vec(), gimple_call_arg(), gimple_call_fn(), gimple_call_lhs(), gimple_call_num_args(), gimple_call_set_lhs(), gimple_get_lhs(), gimple_plf(), gimple_vdef(), gsi_end_p(), gsi_insert_seq_before(), gsi_next(), gsi_remove(), gsi_replace(), GSI_SAME_STMT, gsi_start_bb(), gsi_stmt(), i, ifc_bbs, ifc_temp_var(), INTEGRAL_TYPE_P, is_false_predicate(), is_gimple_assign(), is_gimple_call(), is_true_predicate(), mask_exists(), NULL, NULL_TREE, loop::num_nodes, POINTER_TYPE_P, predicate_load_or_store(), predicate_rhs_code(), release_defs(), rewrite_to_defined_overflow(), poly_int< N, C >::to_constant(), TREE_CODE, TREE_OPERAND, TREE_TYPE, TYPE_MODE, TYPE_OVERFLOW_UNDEFINED, unlink_stmt_vdef(), unshare_expr(), and update_stmt().

Referenced by combine_blocks().

◆ ref_within_array_bound()

bool ref_within_array_bound ( gimple * stmt,
tree ref )
Return TRUE if ref is a within bound array reference.   

References for_each_index(), gcc_assert, idx_within_array_bound(), loop_containing_stmt(), and NULL.

Referenced by ifcvt_memrefs_wont_trap(), and vect_analyze_early_break_dependences().

◆ release_bb_predicate()

static void release_bb_predicate ( basic_block bb)

◆ remove_conditions_and_labels()

static void remove_conditions_and_labels ( loop_p loop)
Remove all GIMPLE_CONDs and GIMPLE_LABELs of all the basic blocks
other than the exit and latch of the LOOP.  Also resets the
GIMPLE_DEBUG information.   

References bb_with_exit_edge_p(), ggc_alloc(), gimple_debug_bind_p(), gimple_debug_bind_reset_value(), gsi_end_p(), gsi_next(), gsi_remove(), gsi_start_bb(), gsi_stmt(), i, ifc_bbs, loop::latch, loop::num_nodes, and update_stmt().

Referenced by combine_blocks().

◆ reset_bb_predicate()

static void reset_bb_predicate ( basic_block bb)

◆ set_bb_predicate()

static void set_bb_predicate ( basic_block bb,
tree cond )

◆ set_bb_predicate_gimplified_stmts()

static void set_bb_predicate_gimplified_stmts ( basic_block bb,
gimple_seq stmts,
bool preserve_counts )
Sets the sequence of statements STMTS of the gimplification of the
predicate for basic block BB.  If PRESERVE_COUNTS then don't clear the predicate

References basic_block_def::aux, ggc_alloc(), and NULL.

Referenced by init_bb_predicate(), insert_gimplified_predicates(), and release_bb_predicate().

◆ strip_nop_cond_scalar_reduction()

static tree strip_nop_cond_scalar_reduction ( bool has_nop,
tree op )
Return reduc_1 if has_nop.

if (...)
  tmp1 = (unsigned type) reduc_1;
  tmp2 = tmp1 + rhs2;
  reduc_3 = (signed type) tmp2.   

References CONVERT_EXPR_CODE_P, ggc_alloc(), gimple_assign_rhs1(), gimple_assign_rhs_code(), NULL_TREE, SSA_NAME_DEF_STMT, TREE_CODE, tree_nop_conversion_p(), and TREE_TYPE.

Referenced by is_cond_scalar_reduction().

◆ tree_if_conversion()

◆ value_available_p()

static bool value_available_p ( gimple * stmt,
hash_set< tree_ssa_name_hash > * ssa_names,
tree value )
Return true if VALUE is available for use at STMT.  SSA_NAMES is
the set of SSA names defined earlier in STMT's block.   

References CDI_DOMINATORS, hash_set< KeyId, Lazy, Traits >::contains(), dominated_by_p(), ggc_alloc(), gimple_bb(), is_gimple_min_invariant(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, and TREE_CODE.

Referenced by predicate_rhs_code().

◆ version_loop_for_if_conversion()

static class loop * version_loop_for_if_conversion ( class loop * loop,
vec< gimple * > * preds )
Version LOOP before if-converting it; the original loop
will be if-converted, the new copy of the loop will not,
and the LOOP_VECTORIZED internal call will be guarding which
loop to execute.  The vectorizer pass will fold this
internal call into either true or false. 

Note that this function intentionally invalidates profile.  Both edges
out of LOOP_VECTORIZED must have 100% probability so the profile remains
consistent after the condition is folded in the vectorizer.   

References profile_probability::always(), any_complicated_phi, loop::aux, boolean_type_node, build_int_cst(), free_original_copy_tables(), g, ggc_alloc(), gimple_build_call_internal(), gimple_call_set_arg(), gimple_call_set_lhs(), gsi_insert_before(), gsi_last_bb(), GSI_SAME_STMT, i, ifc_bbs, initialize_original_copy_tables(), loop::inner, integer_type_node, integer_zero_node, loop_version(), make_ssa_name(), need_to_predicate, NULL, loop::num, loop::num_nodes, TODO_update_ssa_no_phi, and update_ssa().

Referenced by tree_if_conversion().

◆ versionable_outer_loop_p()

static bool versionable_outer_loop_p ( class loop * loop)
Return true when LOOP satisfies the follow conditions that will
allow it to be recognized by the vectorizer for outer-loop
 - The loop is not the root node of the loop tree.
 - The loop has exactly one inner loop.
 - The loop has a single exit.
 - The loop header has a single successor, which is the inner
   loop header.
 - Each of the inner and outer loop latches have a single
 - The loop exit block has a single predecessor, which is the
   inner loop's exit block.   

References loop::dont_vectorize, dump_file, ggc_alloc(), loop::header, loop::inner, loop::latch, loop_outer(), loop::next, single_exit(), single_pred(), single_pred_p(), single_succ(), and single_succ_p().

Referenced by tree_if_conversion().

Variable Documentation

◆ any_complicated_phi

bool any_complicated_phi
Indicate if there are any complicated PHIs that need to be handled in
if-conversion.  Complicated PHI has more than two arguments and can't
be degenerated to two arguments PHI.  See more information in comment
before phi_convertible_by_degenerating_args.   

Referenced by if_convertible_phi_p(), tree_if_conversion(), and version_loop_for_if_conversion().

◆ baseref_DR_map

◆ ifc_bbs

◆ innermost_DR_map

◆ need_to_ifcvt

bool need_to_ifcvt
True if there is any ifcvting to be done.   

Referenced by tree_if_conversion().

◆ need_to_lower_bitfields

bool need_to_lower_bitfields
True if we have bitfield accesses we can lower.   

Referenced by tree_if_conversion().

◆ need_to_predicate

bool need_to_predicate
True if we've converted a statement that was only executed when some
condition C was true, and if for correctness we need to predicate the
statement to ensure that it is a no-op when C is false.  See
predicate_statements for the kinds of predication we support.   

Referenced by combine_blocks(), if_convertible_gimple_assign_stmt_p(), if_convertible_stmt_p(), insert_gimplified_predicates(), tree_if_conversion(), and version_loop_for_if_conversion().

◆ need_to_rewrite_undefined

bool need_to_rewrite_undefined
True if we have to rewrite stmts that may invoke undefined behavior
when a condition C was false so it doesn't if it is always executed.
See predicate_statements for the kinds of predication we support.   

Referenced by combine_blocks(), if_convertible_gimple_assign_stmt_p(), and tree_if_conversion().

◆ redundant_ssa_names

vec< std::pair<tree, tree> > redundant_ssa_names
List of redundant SSA names: the first should be replaced by the second.   

Referenced by predicate_rhs_code(), predicate_scalar_phi(), and tree_if_conversion().