GCC Middle and Back End API 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"
Data Structures | |
struct | innermost_loop_behavior_hash |
struct | bb_predicate |
struct | ifc_dr |
struct | ifcvt_arg_entry |
Macros | |
#define | INCLUDE_MEMORY |
#define | MAX_PHI_ARG_NUM ((unsigned) param_max_tree_if_conversion_phi_args) |
#define | IFC_DR(DR) |
#define | DR_BASE_W_UNCONDITIONALLY(DR) |
#define | DR_RW_UNCONDITIONALLY(DR) |
#define | DR_W_UNCONDITIONALLY(DR) |
Typedefs | |
typedef struct ifcvt_arg_entry | ifcvt_arg_entry_t |
Variables | |
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_block * | ifc_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 |
#define DR_BASE_W_UNCONDITIONALLY | ( | DR | ) |
Referenced by hash_memrefs_baserefs_and_store_DRs_read_written_info(), if_convertible_loop_p_1(), and ifcvt_memrefs_wont_trap().
#define DR_RW_UNCONDITIONALLY | ( | DR | ) |
Referenced by hash_memrefs_baserefs_and_store_DRs_read_written_info(), if_convertible_loop_p_1(), and ifcvt_memrefs_wont_trap().
#define DR_W_UNCONDITIONALLY | ( | DR | ) |
Referenced by hash_memrefs_baserefs_and_store_DRs_read_written_info(), if_convertible_loop_p_1(), and ifcvt_memrefs_wont_trap().
#define IFC_DR | ( | DR | ) |
Referenced by hash_memrefs_baserefs_and_store_DRs_read_written_info(), and if_convertible_loop_p_1().
#define INCLUDE_MEMORY |
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 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/>.
This pass implements a tree level if-conversion of loops. Its initial goal is to help the vectorizer to vectorize loops with conditions. 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: INPUT ----- # i_23 = PHI <0(0), i_18(10)>; <L0>:; j_15 = A[i_23]; if (j_15 > 41) goto <L1>; else goto <L17>; <L17>:; goto <bb 3> (<L3>); <L1>:; # iftmp.2_4 = PHI <0(8), 42(2)>; <L3>:; A[i_23] = iftmp.2_4; i_18 = i_23 + 1; if (i_18 <= 15) goto <L19>; else goto <L18>; <L19>:; goto <bb 1> (<L0>); <L18>:; OUTPUT ------ # i_23 = PHI <0(0), i_18(10)>; <L0>:; j_15 = A[i_23]; <L3>:; 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>; <L19>:; goto <bb 1> (<L0>); <L18>:;
#define MAX_PHI_ARG_NUM ((unsigned) param_max_tree_if_conversion_phi_args) |
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 struct ifcvt_arg_entry 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.
|
inlinestatic |
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(), gsi_stmt(), and bb_predicate::no_predicate_stmts.
Referenced by add_to_predicate_list().
|
static |
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, is_true_predicate(), and loop::latch.
Referenced by predicate_bbs().
|
inlinestatic |
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(), 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().
|
inlinestatic |
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().
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 get_base_address.
References decl_binds_to_current_def_p(), DECL_P, get_base_address(), and TREE_READONLY.
Referenced by ifcvt_memrefs_wont_trap().
|
inlinestatic |
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().
|
inlinestatic |
Returns the gimplified predicate for basic block BB.
References basic_block_def::aux.
Referenced by add_to_predicate_list(), analyze_function_body(), gen_phi_arg_condition(), hash_memrefs_baserefs_and_store_DRs_read_written_info(), predicate_bbs(), predicate_scalar_phi(), and predicate_statements().
|
inlinestatic |
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().
|
static |
Return true if one of the successor edges of BB exits LOOP.
References FOR_EACH_EDGE, loop_exit_edge_p(), and basic_block_def::succs.
Referenced by get_loop_body_in_if_conv_order(), if_convertible_loop_p_1(), ifcvt_split_critical_edges(), predicate_bbs(), and remove_conditions_and_labels().
|
static |
Return TRUE if there are bitfields to lower in this LOOP. Fill TO_LOWER with data structures representing these bitfields.
References DECL_BIT_FIELD_TYPE, dump_file, dump_flags, dyn_cast(), get_bitfield_rep(), gimple_assign_lhs(), gimple_assign_rhs1(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), i, ifc_bbs, INTEGRAL_TYPE_P, NULL, loop::num, loop::num_nodes, print_gimple_stmt(), TDF_DETAILS, TDF_SLIM, TREE_CODE, TREE_OPERAND, TREE_THIS_VOLATILE, and TREE_TYPE.
Referenced by tree_if_conversion().
|
static |
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().
|
static |
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 dyn_cast(), 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().
|
static |
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 ifcvt_arg_entry::num_compares, and ifcvt_arg_entry::occurs.
Referenced by predicate_scalar_phi().
Combine all the basic blocks from LOOP into one or two super basic blocks. Replace PHI nodes with conditional modify expressions. LOOP_VERSIONED should be true if we know that the loop was versioned for vectorization.
References bb_seq(), can_merge_blocks_p(), CDI_DOMINATORS, delete_basic_block(), ei_next(), ei_safe_edge(), ei_start, FOR_EACH_EDGE, FOR_EACH_IMM_USE_ON_STMT, FOR_EACH_IMM_USE_STMT, FOR_EACH_SSA_TREE_OPERAND, free(), free_bb_predicate(), gcc_assert, get_virtual_phi(), gimple_phi_arg_def(), gimple_phi_result(), gimple_set_bb(), gimple_vdef(), gimple_vuse(), gsi_end_p(), gsi_for_stmt(), gsi_insert_seq_after_without_update(), gsi_last_bb(), GSI_NEW_STMT, gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), loop::header, i, ifc_bbs, insert_gimplified_predicates(), is_predicated(), last, loop::latch, loop_exit_edge_p(), make_edge(), make_single_succ_edge(), merge_blocks(), need_to_predicate, need_to_rewrite_undefined, NULL, NULL_TREE, loop::num_nodes, predicate_all_scalar_phis(), predicate_statements(), basic_block_def::preds, redirect_edge_and_branch(), remove_conditions_and_labels(), remove_edge(), remove_phi_node(), reset_flow_sensitive_info(), set_bb_seq(), set_immediate_dominator(), SET_USE, single_exit(), SSA_NAME_OCCURS_IN_ABNORMAL_PHI, SSA_OP_DEF, ssa_vuse_operand(), basic_block_def::succs, and USE_FROM_PTR.
Referenced by tree_if_conversion().
|
static |
Converts conditional scalar reduction into unconditional form, e.g. bb_4 if (_5 != 0) goto bb_5 else goto bb_6 end_bb_4 bb_5 res_6 = res_13 + 1; end_bb_5 bb_6 # res_2 = PHI <res_13(4), res_6(5)> end_bb_6 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 swapped. 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(), 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, 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().
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(), gimple_match_op::code, follow_all_ssa_edges(), gimple_simplified_result_is_gimple_val(), integer_zerop(), NULL, gimple_match_op::ops, gimple_match_op::resimplify(), 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().
Returns the fold of predicate C1 OR C2 at location LOC.
References boolean_type_node, fold_build2_loc(), maybe_fold_or_comparisons(), and parse_predicate().
Referenced by add_to_predicate_list(), gen_phi_arg_condition(), and hash_memrefs_baserefs_and_store_DRs_read_written_info().
|
inlinestatic |
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().
|
static |
Produce condition for all occurrences of ARG in PHI node. Set *INVERT as to whether the condition is inverted.
References hash_set< KeyId, Lazy, Traits >::add(), bb_predicate(), EXPR_LOCATION, fold_or_predicates(), force_gimple_operand_gsi(), gcc_assert, gen_simplified_condition(), gimple_phi_arg_edge(), GSI_SAME_STMT, i, ifcvt_arg_entry::indexes, scalar_cond_masked_key::inverted_p, is_true_predicate(), NULL_TREE, TREE_CODE, TREE_OPERAND, and unshare_expr().
Referenced by gen_phi_nest_statement().
|
static |
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 into _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(), 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().
|
static |
Generate a simplified conditional.
References as_a(), boolean_true_node, boolean_type_node, hash_set< KeyId, Lazy, Traits >::contains(), fold_build2, gen_simplified_condition(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), NULL, SSA_NAME_DEF_STMT, and TREE_CODE.
Referenced by gen_phi_arg_condition(), gen_simplified_condition(), and predicate_scalar_phi().
|
inlinestatic |
Return the number of statements the predicate of the basic block consists of.
References basic_block_def::aux.
Referenced by predicate_scalar_phi().
|
static |
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 bitfield.
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, 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().
|
static |
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 as_a(), 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(), 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().
|
static |
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(), gimple_bb(), IFC_DR, innermost_DR_map, is_true_predicate(), and UNKNOWN_LOCATION.
Referenced by if_convertible_loop_p_1().
Return TRUE if can prove the index IDX of an array reference REF is within array bound. Return false otherwise.
References analyze_scalar_evolution(), array_ref_flexible_size_p(), array_ref_low_bound(), array_ref_up_bound(), wi::div_floor(), evolution_part_in_loop_num(), initial_condition(), instantiate_parameters(), integer_zerop(), max_loop_iterations(), loop::num, SIGNED, wi::to_widest(), and TREE_CODE.
Referenced by ref_within_array_bound().
|
static |
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, gimple_call_ctrl_altering_p(), gsi_last_bb(), basic_block_def::index, loop::latch, safe_dyn_cast(), basic_block_def::succs, and TDF_DETAILS.
Referenced by if_convertible_loop_p_1().
|
static |
Return true when STMT is if-convertible. GIMPLE_ASSIGN statement is not if-convertible if, - it is not movable, - it could trap, - LHS is not var decl.
References arith_code_with_undefined_signed_overflow(), dump_file, dump_flags, GF_PLF_2, gimple_assign_lhs(), gimple_assign_rhs_code(), gimple_could_trap_p(), gimple_could_trap_p_1(), gimple_has_side_effects(), gimple_has_volatile_ops(), gimple_set_plf(), gimple_vdef(), gimple_vuse(), ifcvt_can_predicate(), ifcvt_memrefs_wont_trap(), INTEGRAL_TYPE_P, is_gimple_reg_type(), need_to_predicate, need_to_rewrite_undefined, POINTER_TYPE_P, print_gimple_stmt(), SSA_NAME_OCCURS_IN_ABNORMAL_PHI, stmt_ends_bb_p(), TDF_DETAILS, TDF_SLIM, TREE_CODE, TREE_TYPE, and TYPE_OVERFLOW_UNDEFINED.
Referenced by if_convertible_stmt_p().
|
static |
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, loop::header, if_convertible_loop_p_1(), loop::inner, innermost_DR_map, loop_exit_edge_p(), NULL, loop::num_nodes, basic_block_def::succs, and TDF_DETAILS.
Referenced by tree_if_conversion().
|
static |
Return true when LOOP is if-convertible. This is a helper function for if_convertible_loop_p. REFS and DDRS are initialized and freed in if_convertible_loop_p.
References data_reference::aux, baseref_DR_map, bb_with_exit_edge_p(), boolean_false_node, build_region(), calculate_dominance_info(), calculate_dominance_info_for_region(), CDI_DOMINATORS, CDI_POST_DOMINATORS, cfun, dominated_by_p(), DR_BASE_ADDRESS, DR_BASE_W_UNCONDITIONALLY, DR_INIT, DR_INNERMOST, DR_OFFSET, DR_REF, DR_RW_UNCONDITIONALLY, DR_STEP, DR_STMT, DR_W_UNCONDITIONALLY, dump_file, free_dominance_info_for_region(), gimple_set_uid(), gimple_uid(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), hash_memrefs_baserefs_and_store_DRs_read_written_info(), i, if_convertible_bb_p(), if_convertible_phi_p(), if_convertible_stmt_p(), ifc_bbs, IFC_DR, innermost_DR_map, loop::latch, NULL, loop::num_nodes, gphi_iterator::phi(), predicate_bbs(), TREE_CODE, and TREE_OPERAND.
Referenced by if_convertible_loop_p().
|
static |
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, 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().
|
static |
Return true when STMT is if-convertible. A statement is if-convertible if: - it is an if-convertible GIMPLE_ASSIGN, - it is a GIMPLE_LABEL or a GIMPLE_COND, - it is a switch equivalent to COND - it is builtins call, - it is a call to a function with a SIMD clone.
References as_a(), dump_file, dump_flags, ECF_CONST, ECF_LOOPING_CONST_OR_PURE, cgraph_node::get(), GF_PLF_2, gimple_call_combined_fn(), gimple_call_flags(), gimple_call_fndecl(), gimple_set_plf(), if_convertible_gimple_assign_stmt_p(), if_convertible_switch_p(), need_to_predicate, cgraph_simd_clone::next_clone, NULL, print_gimple_stmt(), cgraph_node::simd_clones, cgraph_node::simdclone, TDF_DETAILS, and TDF_SLIM.
Referenced by if_convertible_loop_p_1().
Return true when SW switch statement is equivalent to cond, that all non default labels point to the same label. Fallthrough is not checked for and could even happen with cond (using goto), so is handled. This is intended for switches created by the if-switch-conversion pass, but can handle some programmer supplied cases too.
References CASE_LABEL, gimple_switch_label(), gimple_switch_num_labels(), and i.
Referenced by if_convertible_stmt_p().
|
static |
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 statement.
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().
Return true if VALUE is already available on edge PE.
References CDI_DOMINATORS, dominated_by_p(), gimple_bb(), is_gimple_min_invariant(), SSA_NAME_DEF_STMT, and TREE_CODE.
Referenced by ifcvt_can_hoist().
Return true if STMT can be hoisted from if-converted loop LOOP to edge PE.
References cfun, dyn_cast(), expr_invariant_in_loop_p(), gimple_arg(), gimple_assign_rhs_code(), gimple_call_internal_fn(), gimple_call_internal_p(), gimple_could_trap_p(), gimple_has_side_effects(), gimple_num_args(), gimple_vdef(), gimple_vuse(), i, ifcvt_available_on_edge_p(), internal_fn_mask_index(), loop_preheader_edge(), and stmt_could_throw_p().
Referenced by ifcvt_hoist_invariants().
Return true if STMT could be converted from an operation that is unconditional to one that is conditional on a bb predicate mask.
References loop::dont_vectorize, loop::force_vectorize, get_conditional_internal_fn(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_assign_single_p(), gimple_bb(), gimple_has_volatile_ops(), ifcvt_can_use_mask_load_store(), basic_block_def::loop_father, TREE_TYPE, types_compatible_p(), and vectorized_internal_fn_supported_p().
Referenced by if_convertible_gimple_assign_stmt_p().
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(), 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().
Hoist invariant statements from LOOP to edge PE.
References gsi_end_p(), gsi_for_stmt(), gsi_insert_after(), gsi_insert_on_edge_immediate(), GSI_NEW_STMT, gsi_next(), gsi_remove(), gsi_start_bb(), gsi_stmt(), loop::header, ifcvt_can_hoist(), and gimple_stmt_iterator::ptr.
Referenced by tree_if_conversion().
|
static |
Delete redundant statements produced by predication which prevents loop vectorization.
References ao_ref_init(), delete_dead_or_redundant_assignment(), dse_classify_store(), DSE_STORE_DEAD, dump_file, dump_flags, FOR_EACH_IMM_USE_FAST, FOR_EACH_PHI_OR_STMT_USE, GF_PLF_2, gimple_assign_lhs(), gimple_assign_load_p(), gimple_bb(), gimple_get_lhs(), gimple_has_volatile_ops(), gimple_phi_result(), gimple_plf(), gimple_set_plf(), gimple_store_p(), gimple_vdef(), gsi_end_p(), gsi_last_bb(), gsi_next(), gsi_prev(), gsi_remove(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), loop::header, basic_block_def::index, is_gimple_debug(), loop_latch_edge(), NULL, NULL_TREE, PHI_ARG_DEF_FROM_EDGE, print_gimple_stmt(), release_defs(), SSA_NAME_DEF_STMT, SSA_OP_USE, TDF_DETAILS, TDF_SLIM, TREE_CODE, USE_FROM_PTR, USE_STMT, virtual_operand_p(), and worklist.
Referenced by tree_if_conversion().
|
static |
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 function. - 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, gimple_uid(), innermost_DR_map, NULL, ref_can_have_store_data_races(), and ref_within_array_bound().
Referenced by if_convertible_gimple_assign_stmt_p().
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(), 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, safe_is_a(), split_edge(), basic_block_def::succs, and TDF_DETAILS.
Referenced by tree_if_conversion().
|
inlinestatic |
Initializes to TRUE the predicate of basic block BB.
References basic_block_def::aux, boolean_true_node, NULL, set_bb_predicate(), and set_bb_predicate_gimplified_stmts().
Referenced by predicate_bbs(), and reset_bb_predicate().
|
static |
Insert in each basic block of LOOP the statements produced by the gimplification of the predicates.
References bb_predicate_gimplified_stmts(), gcc_assert, gsi_after_labels(), gsi_end_p(), gsi_insert_seq_after(), gsi_insert_seq_before(), gsi_last_bb(), GSI_SAME_STMT, gsi_stmt(), i, ifc_bbs, is_predicated(), need_to_predicate, NULL, loop::num_nodes, reset_bb_predicate(), set_bb_predicate_gimplified_stmts(), and stmt_ends_bb_p().
Referenced by combine_blocks().
|
static |
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: loop-header: 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, 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().
Return true when COND is a false predicate.
References boolean_false_node, integer_zerop(), and NULL_TREE.
Referenced by predicate_statements().
|
inlinestatic |
Returns true when BB has a predicate that is not trivial: true or NULL_TREE.
References is_true_predicate().
Referenced by add_to_predicate_list(), combine_blocks(), insert_gimplified_predicates(), and is_cond_scalar_reduction().
Return true when COND is a true predicate.
References boolean_true_node, integer_onep(), and NULL_TREE.
Referenced by add_to_dst_predicate_list(), add_to_predicate_list(), gen_phi_arg_condition(), hash_memrefs_baserefs_and_store_DRs_read_written_info(), is_predicated(), and predicate_statements().
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(), 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().
gimple_opt_pass * make_pass_if_conversion | ( | gcc::context * | ctxt | ) |
|
static |
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.
Referenced by predicate_statements().
Parses the predicate COND and returns its comparison code and operands OP0 and OP1.
References COMPARISON_CLASS_P, gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), HONOR_NANS(), invert_tree_comparison(), is_gimple_assign(), parse_predicate(), SSA_NAME_DEF_STMT, tcc_comparison, TREE_CODE, TREE_CODE_CLASS, TREE_OPERAND, and TREE_TYPE.
Referenced by fold_or_predicates(), and parse_predicate().
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().
|
static |
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().
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 vectorization.
References gimple_phi_result(), gsi_after_labels(), gsi_end_p(), gsi_next(), gsi_start_phis(), loop::header, i, ifc_bbs, loop::num_nodes, gphi_iterator::phi(), predicate_scalar_phi(), remove_phi_node(), and virtual_operand_p().
Referenced by combine_blocks().
|
static |
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(), CASE_HIGH, CASE_LABEL, CASE_LOW, cfun, gimple_match_op::code, extract_true_false_edges_from_block(), find_edge(), follow_all_ssa_edges(), gcc_assert, gimple_bb(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_location(), gimple_switch_default_label(), gimple_switch_index(), gimple_switch_label(), gimple_switch_num_labels(), gsi_last_bb(), loop::header, i, ifc_bbs, init_bb_predicate(), code_helper::is_tree_code(), label_to_block(), loop::latch, NULL, NULL_TREE, loop::num_nodes, gimple_match_op::ops, reset_bb_predicate(), gimple_match_op::resimplify(), safe_dyn_cast(), single_succ(), single_succ_p(), tcc_comparison, TREE_CODE_CLASS, gimple_match_cond::UNCOND, and unshare_expr().
Referenced by if_convertible_loop_p_1().
|
static |
Helper function for predicate_statements. STMT is a memory read or write and it needs to be predicated by MASK. Return a statement that does so.
References build2(), build_fold_addr_expr, build_int_cst(), copy_ref_info(), force_gimple_operand_gsi(), get_object_alignment(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_build_call_internal(), gimple_call_set_lhs(), gimple_call_set_nothrow(), gimple_move_vops(), gimple_set_vuse(), gimple_vuse(), GSI_SAME_STMT, mark_addressable(), NULL_TREE, reference_alias_ptr_type(), SSA_NAME_PTR_INFO, TREE_CODE, and TREE_TYPE.
Referenced by predicate_statements().
|
static |
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(), 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().
|
static |
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 vectorization.
References hash_set< KeyId, Lazy, Traits >::add(), 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(), hash_map< KeyId, Value, Traits >::get(), get_bb_num_predicate_stmts(), hash_map< KeyId, Value, Traits >::get_or_insert(), 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().
|
static |
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(), dyn_cast(), hash_set< KeyId, Lazy, Traits >::empty(), fold_build_cond_expr(), force_gimple_operand_gsi(), GET_MODE_BITSIZE(), GF_PLF_2, 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().
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().
|
inlinestatic |
Release the SSA_NAMEs associated with the predicate of basic block BB.
References bb_predicate_gimplified_stmts(), gcc_assert, gimple_bb(), gimple_seq_discard(), gsi_end_p(), gsi_next(), gsi_start(), gsi_stmt(), i, NULL, and set_bb_predicate_gimplified_stmts().
Referenced by free_bb_predicate(), and reset_bb_predicate().
|
static |
Remove all GIMPLE_CONDs and GIMPLE_LABELs and GIMPLE_SWITCH 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(), 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().
|
inlinestatic |
Reinitialize predicate of BB with the true predicate.
References bb_has_predicate(), boolean_true_node, init_bb_predicate(), release_bb_predicate(), and set_bb_predicate().
Referenced by add_to_predicate_list(), insert_gimplified_predicates(), and predicate_bbs().
|
inlinestatic |
Sets the gimplified predicate COND for basic block BB.
References basic_block_def::aux, dump_file, dump_flags, gcc_assert, basic_block_def::index, is_gimple_val(), TDF_DETAILS, TREE_CODE, and TREE_OPERAND.
Referenced by add_to_predicate_list(), init_bb_predicate(), and reset_bb_predicate().
|
inlinestatic |
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 counts.
References basic_block_def::aux, bb_predicate::no_predicate_stmts, NULL, and bb_predicate::predicate_gimplified_stmts.
Referenced by init_bb_predicate(), insert_gimplified_predicates(), and release_bb_predicate().
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, gimple_assign_rhs1(), gimple_assign_rhs_code(), NULL_TREE, safe_dyn_cast(), SSA_NAME_DEF_STMT, TREE_CODE, tree_nop_conversion_p(), and TREE_TYPE.
Referenced by is_cond_scalar_reduction().
If-convert LOOP when it is legal. For the moment this pass has no profitability analysis. Returns non-zero todo flags when something changed.
References any_complicated_phi, data_reference::aux, bitfields_to_lower_p(), BITMAP_ALLOC, BITMAP_FREE, bitmap_set_bit, cfun, chrec_dont_know, combine_blocks(), dbg_cnt(), do_rpo_vn(), loop::dont_vectorize, dump_file, dump_flags, find_data_references_in_loop(), FOR_EACH_VEC_ELT, loop::force_vectorize, free(), free_bb_predicate(), free_data_ref(), gcc_assert, get_loop_body_in_if_conv_order(), get_loop_exit_edges(), gimple_bb(), i, if_convertible_loop_p(), ifc_bbs, ifcvt_hoist_invariants(), ifcvt_local_dce(), ifcvt_split_critical_edges(), loop::inner, loop_outer(), loop_preheader_edge(), lower_bitfield(), need_to_ifcvt, need_to_lower_bitfields, need_to_predicate, need_to_rewrite_undefined, loop::next, NULL, loop::num_nodes, redundant_ssa_names, replace_uses_by(), single_exit(), single_pred_edge(), TDF_DETAILS, todo, TODO_cleanup_cfg, version_loop_for_if_conversion(), and versionable_outer_loop_p().
|
static |
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(), gimple_bb(), is_gimple_min_invariant(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, and TREE_CODE.
Referenced by predicate_rhs_code().
|
static |
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(), loop::dont_vectorize, loop::force_vectorize, free_original_copy_tables(), g, 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().
Return true when LOOP satisfies the follow conditions that will allow it to be recognized by the vectorizer for outer-loop vectorization: - 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 predecessor. - The loop exit block has a single predecessor, which is the inner loop's exit block.
References loop::dont_vectorize, dump_file, 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().
|
static |
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().
|
static |
Hash table to store <base reference, DR> pairs.
Referenced by hash_memrefs_baserefs_and_store_DRs_read_written_info(), if_convertible_loop_p(), if_convertible_loop_p_1(), and ifcvt_memrefs_wont_trap().
|
static |
List of basic blocks in if-conversion-suitable order.
Referenced by bitfields_to_lower_p(), build_region(), combine_blocks(), if_convertible_loop_p_1(), insert_gimplified_predicates(), predicate_all_scalar_phis(), predicate_bbs(), predicate_statements(), remove_conditions_and_labels(), tree_if_conversion(), and version_loop_for_if_conversion().
|
static |
Hash table to store <DR's innermost loop behavior, DR> pairs.
Referenced by hash_memrefs_baserefs_and_store_DRs_read_written_info(), if_convertible_loop_p(), if_convertible_loop_p_1(), and ifcvt_memrefs_wont_trap().
|
static |
True if there is any ifcvting to be done.
Referenced by tree_if_conversion().
|
static |
True if we have bitfield accesses we can lower.
Referenced by tree_if_conversion().
|
static |
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().
|
static |
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().
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().