GCC Middle and Back End API Reference
tree-ssa-forwprop.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 "optabs-query.h"
#include "gimple-pretty-print.h"
#include "fold-const.h"
#include "stor-layout.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
#include "gimplify-me.h"
#include "tree-cfg.h"
#include "expr.h"
#include "tree-dfa.h"
#include "tree-ssa-propagate.h"
#include "tree-ssa-dom.h"
#include "tree-ssa-strlen.h"
#include "builtins.h"
#include "tree-cfgcleanup.h"
#include "cfganal.h"
#include "optabs-tree.h"
#include "insn-config.h"
#include "recog.h"
#include "cfgloop.h"
#include "tree-vectorizer.h"
#include "tree-vector-builder.h"
#include "vec-perm-indices.h"
#include "internal-fn.h"
#include "cgraph.h"
#include "tree-ssa.h"
#include "gimple-range.h"
#include "tree-ssa-dce.h"
Include dependency graph for tree-ssa-forwprop.cc:

Data Structures

struct  _vec_perm_simplify_seq
 

Macros

#define CPD_ITERATIONS   5
 
#define CASE_ATOMIC(NAME, OTHER, OP)
 

Typedefs

typedef struct _vec_perm_simplify_seqvec_perm_simplify_seq
 

Functions

static bool forward_propagate_addr_expr (tree, tree, bool)
 
static tree rhs_to_tree (tree type, gimple *stmt)
 
static void fwprop_set_lattice_val (tree name, tree val)
 
static void fwprop_invalidate_lattice (tree name)
 
static gimpleget_prop_source_stmt (tree name, bool single_use_only, bool *single_use_p)
 
static bool can_propagate_from (gimple *def_stmt)
 
static bool remove_prop_source_from_use (tree name)
 
static tree combine_cond_expr_cond (gimple *stmt, enum tree_code code, tree type, tree op0, tree op1, bool invariant_only)
 
static tree forward_propagate_into_comparison_1 (gimple *stmt, enum tree_code code, tree type, tree op0, tree op1)
 
static int forward_propagate_into_comparison (gimple_stmt_iterator *gsi)
 
static int forward_propagate_into_gimple_cond (gcond *stmt)
 
static void tidy_after_forward_propagate_addr (gimple *stmt)
 
static bool forward_propagate_addr_expr_1 (tree name, tree def_rhs, gimple_stmt_iterator *use_stmt_gsi, bool single_use_p)
 
static void simplify_gimple_switch_label_vec (gswitch *stmt, tree index_type, vec< std::pair< int, int > > &edges_to_remove)
 
static bool simplify_gimple_switch (gswitch *stmt, vec< std::pair< int, int > > &edges_to_remove)
 
static tree constant_pointer_difference (tree p1, tree p2)
 
static bool simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2)
 
static void defcodefor_name (tree name, enum tree_code *code, tree *arg1, tree *arg2)
 
static bool simplify_rotate (gimple_stmt_iterator *gsi)
 
static bool check_ctz_array (tree ctor, unsigned HOST_WIDE_INT mulc, HOST_WIDE_INT &zero_val, unsigned shift, unsigned bits)
 
static bool check_ctz_string (tree string, unsigned HOST_WIDE_INT mulc, HOST_WIDE_INT &zero_val, unsigned shift, unsigned bits)
 
static bool optimize_count_trailing_zeroes (tree array_ref, tree x, tree mulc, tree tshift, HOST_WIDE_INT &zero_val)
 
bool gimple_ctz_table_index (tree, tree *, tree(*)(tree))
 
static bool simplify_count_trailing_zeroes (gimple_stmt_iterator *gsi)
 
static bool simplify_bitfield_ref (gimple_stmt_iterator *gsi)
 
static int is_combined_permutation_identity (tree mask1, tree mask2)
 
static int simplify_permutation (gimple_stmt_iterator *gsi)
 
static tree get_bit_field_ref_def (tree val, enum tree_code &conv_code)
 
static bool simplify_vector_constructor (gimple_stmt_iterator *gsi)
 
static tree prepare_target_mem_ref_lvalue (tree ref, gimple_stmt_iterator *gsi)
 
static void optimize_vector_load (gimple_stmt_iterator *gsi)
 
static tree fwprop_ssa_val (tree name)
 
static bool recognise_vec_perm_simplify_seq (gassign *stmt, vec_perm_simplify_seq *seq)
 
static void narrow_vec_perm_simplify_seq (const vec_perm_simplify_seq &seq)
 
static bool can_blend_vec_perm_simplify_seqs_p (vec_perm_simplify_seq seq1, vec_perm_simplify_seq seq2, bool *need_swap)
 
static bool calc_perm_vec_perm_simplify_seqs (vec_perm_simplify_seq seq1, vec_perm_simplify_seq seq2, vec_perm_indices *seq2_stmt_indices, vec_perm_indices *seq1_v_1_stmt_indices, vec_perm_indices *seq1_v_2_stmt_indices)
 
static void blend_vec_perm_simplify_seqs (vec_perm_simplify_seq seq1, vec_perm_simplify_seq seq2, const vec_perm_indices &seq2_stmt_indices, const vec_perm_indices &seq1_v_1_stmt_indices, const vec_perm_indices &seq1_v_2_stmt_indices)
 
static void process_vec_perm_simplify_seq_list (vec< vec_perm_simplify_seq > *l)
 
static void append_vec_perm_simplify_seq_list (vec< vec_perm_simplify_seq > *l, const vec_perm_simplify_seq &seq)
 
gimple_opt_passmake_pass_forwprop (gcc::context *ctxt)
 

Variables

static bool cfg_changed
 
static bitmap to_purge
 
static vec< treelattice
 

Macro Definition Documentation

◆ CASE_ATOMIC

#define CASE_ATOMIC ( NAME,
OTHER,
OP )
Value:
case BUILT_IN_##NAME##_1: \
case BUILT_IN_##NAME##_2: \
case BUILT_IN_##NAME##_4: \
case BUILT_IN_##NAME##_8: \
case BUILT_IN_##NAME##_16: \
atomic_op = OP; \
other_atomic \
= (enum built_in_function) (BUILT_IN_##OTHER##_1 \
+ (DECL_FUNCTION_CODE (callee2) \
- BUILT_IN_##NAME##_1)); \
goto handle_atomic_fetch_op;
built_in_function
Definition genmatch.cc:999
@ NAME
Definition tree-ssa-pre.cc:242
built_in_function DECL_FUNCTION_CODE(const_tree decl)
Definition tree.h:4381

Referenced by simplify_builtin_call().

◆ CPD_ITERATIONS

#define CPD_ITERATIONS   5

Typedef Documentation

◆ vec_perm_simplify_seq

Function Documentation

◆ append_vec_perm_simplify_seq_list()

static void append_vec_perm_simplify_seq_list ( vec< vec_perm_simplify_seq > * l,
const vec_perm_simplify_seq & seq )
static

◆ blend_vec_perm_simplify_seqs()

static void blend_vec_perm_simplify_seqs ( vec_perm_simplify_seq seq1,
vec_perm_simplify_seq seq2,
const vec_perm_indices & seq2_stmt_indices,
const vec_perm_indices & seq1_v_1_stmt_indices,
const vec_perm_indices & seq1_v_2_stmt_indices )
static

◆ calc_perm_vec_perm_simplify_seqs()

static bool calc_perm_vec_perm_simplify_seqs ( vec_perm_simplify_seq seq1,
vec_perm_simplify_seq seq2,
vec_perm_indices * seq2_stmt_indices,
vec_perm_indices * seq1_v_1_stmt_indices,
vec_perm_indices * seq1_v_2_stmt_indices )
static

◆ can_blend_vec_perm_simplify_seqs_p()

static bool can_blend_vec_perm_simplify_seqs_p ( vec_perm_simplify_seq seq1,
vec_perm_simplify_seq seq2,
bool * need_swap )
static

◆ can_propagate_from()

◆ check_ctz_array()

static bool check_ctz_array ( tree ctor,
unsigned HOST_WIDE_INT mulc,
HOST_WIDE_INT & zero_val,
unsigned shift,
unsigned bits )
static

◆ check_ctz_string()

static bool check_ctz_string ( tree string,
unsigned HOST_WIDE_INT mulc,
HOST_WIDE_INT & zero_val,
unsigned shift,
unsigned bits )
static
Check whether a string contains a valid ctz table.   

References HOST_WIDE_INT_1U, i, shift, TREE_STRING_LENGTH, and TREE_STRING_POINTER.

Referenced by optimize_count_trailing_zeroes().

◆ combine_cond_expr_cond()

static tree combine_cond_expr_cond ( gimple * stmt,
enum tree_code code,
tree type,
tree op0,
tree op1,
bool invariant_only )
static
Combine OP0 CODE OP1 in the context of a COND_EXPR.  Returns
the folded result in a form suitable for COND_EXPR_COND or
NULL_TREE, if there is no suitable simplified form.  If
INVARIANT_ONLY is true only gimple_min_invariant results are
considered simplified.   

References canonicalize_cond_expr_cond(), fold_binary_loc(), fold_defer_overflow_warnings(), fold_undefer_overflow_warnings(), gcc_assert, gimple_location(), is_gimple_min_invariant(), NULL, NULL_TREE, _vec_perm_simplify_seq::stmt, tcc_comparison, TREE_CODE, TREE_CODE_CLASS, TREE_TYPE, and warning_suppressed_p().

Referenced by forward_propagate_into_comparison_1().

◆ constant_pointer_difference()

◆ defcodefor_name()

static void defcodefor_name ( tree name,
enum tree_code * code,
tree * arg1,
tree * arg2 )
inlinestatic
Given a ssa_name in NAME see if it was defined by an assignment and
set CODE to be the code and ARG1 to the first operand on the rhs and ARG2
to the second operand on the rhs.  

References can_propagate_from(), get_gimple_rhs_class(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs3(), gimple_assign_rhs_code(), GIMPLE_SINGLE_RHS, is_gimple_assign(), NULL_TREE, SSA_NAME_DEF_STMT, and TREE_CODE.

Referenced by simplify_rotate().

◆ forward_propagate_addr_expr()

static bool forward_propagate_addr_expr ( tree name,
tree rhs,
bool parent_single_use_p )
static
STMT is a statement of the form SSA_NAME = ADDR_EXPR <whatever>.

Try to forward propagate the ADDR_EXPR into all uses of the SSA_NAME.
Often this will allow for removal of an ADDR_EXPR and INDIRECT_REF
node or for recovery of array indexing from pointer arithmetic.

PARENT_SINGLE_USE_P tells if, when in a recursive invocation, NAME was
the single use in the previous invocation.  Pass true when calling
this as toplevel.

Returns true, if all uses have been propagated into.   

References FOR_EACH_IMM_USE_STMT, forward_propagate_addr_expr_1(), fwprop_invalidate_lattice(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_get_lhs(), gsi_for_stmt(), gsi_remove(), gsi_stmt(), has_single_use(), has_zero_uses(), is_gimple_assign(), is_gimple_debug(), release_defs(), TREE_CODE, and update_stmt().

Referenced by forward_propagate_addr_expr_1().

◆ forward_propagate_addr_expr_1()

static bool forward_propagate_addr_expr_1 ( tree name,
tree def_rhs,
gimple_stmt_iterator * use_stmt_gsi,
bool single_use_p )
static

◆ forward_propagate_into_comparison()

static int forward_propagate_into_comparison ( gimple_stmt_iterator * gsi)
static
Propagate from the ssa name definition statements of the assignment
from a comparison at *GSI into the conditional if that simplifies it.
Returns 1 if the stmt was modified and 2 if the CFG needs cleanup,
otherwise returns 0.   

References cfg_changed, fold_stmt(), forward_propagate_into_comparison_1(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_assign_set_rhs_from_tree(), gsi_stmt(), remove_prop_source_from_use(), _vec_perm_simplify_seq::stmt, TREE_CODE, TREE_TYPE, update_stmt(), and useless_type_conversion_p().

◆ forward_propagate_into_comparison_1()

static tree forward_propagate_into_comparison_1 ( gimple * stmt,
enum tree_code code,
tree type,
tree op0,
tree op1 )
static
Combine the comparison OP0 CODE OP1 at LOC with the defining statements
of its operand.  Return a new comparison tree or NULL_TREE if there
were no simplifying combines.   

References can_propagate_from(), combine_cond_expr_cond(), CONVERT_EXPR_CODE_P, get_prop_source_stmt(), gimple_assign_rhs_code(), NULL_TREE, rhs_to_tree(), _vec_perm_simplify_seq::stmt, tcc_comparison, TREE_CODE, TREE_CODE_CLASS, TREE_OPERAND, and TREE_TYPE.

Referenced by forward_propagate_into_comparison(), and forward_propagate_into_gimple_cond().

◆ forward_propagate_into_gimple_cond()

static int forward_propagate_into_gimple_cond ( gcond * stmt)
static

◆ fwprop_invalidate_lattice()

static void fwprop_invalidate_lattice ( tree name)
static
Invalidate the lattice entry for NAME, done when releasing SSA names.   

References lattice, NULL_TREE, SSA_NAME_VERSION, and TREE_CODE.

Referenced by forward_propagate_addr_expr(), remove_prop_source_from_use(), and simplify_builtin_call().

◆ fwprop_set_lattice_val()

static void fwprop_set_lattice_val ( tree name,
tree val )
static
Set the lattice entry for NAME to VAL.   

References lattice, maybe_duplicate_ssa_info_at_copy(), num_ssa_names, SSA_NAME_VERSION, and TREE_CODE.

◆ fwprop_ssa_val()

static tree fwprop_ssa_val ( tree name)
static
Primitive "lattice" function for gimple_simplify.   

References lattice, SSA_NAME_VERSION, and TREE_CODE.

◆ get_bit_field_ref_def()

static tree get_bit_field_ref_def ( tree val,
enum tree_code & conv_code )
static
Get the BIT_FIELD_REF definition of VAL, if any, looking through
conversions with code CONV_CODE or update it if still ERROR_MARK.
Return NULL_TREE if no such matching def was found.   

References CONVERT_EXPR_CODE_P, get_prop_source_stmt(), gimple_assign_rhs1(), gimple_assign_rhs_code(), is_gimple_assign(), NULL, NULL_TREE, SSA_NAME_DEF_STMT, and TREE_CODE.

Referenced by simplify_vector_constructor().

◆ get_prop_source_stmt()

static gimple * get_prop_source_stmt ( tree name,
bool single_use_only,
bool * single_use_p )
static
Get the statement we can propagate from into NAME skipping
trivial copies.  Returns the statement which defines the
propagation source or NULL_TREE if there is no such one.
If SINGLE_USE_ONLY is set considers only sources which have
a single use chain up to NAME.  If SINGLE_USE_P is non-null,
it is set to whether the chain to NAME is a single use chain
or not.  SINGLE_USE_P is not written to if SINGLE_USE_ONLY is set.   

References gimple_assign_rhs1(), gimple_assign_rhs_code(), has_single_use(), is_gimple_assign(), NULL, single_use(), and SSA_NAME_DEF_STMT.

Referenced by forward_propagate_into_comparison_1(), get_bit_field_ref_def(), simplify_bitfield_ref(), and simplify_permutation().

◆ gimple_ctz_table_index()

bool gimple_ctz_table_index ( tree ,
tree * ,
tree(*  )(tree) )
extern
Match.pd function to match the ctz expression.   

Referenced by simplify_count_trailing_zeroes().

◆ is_combined_permutation_identity()

static int is_combined_permutation_identity ( tree mask1,
tree mask2 )
static

◆ make_pass_forwprop()

gimple_opt_pass * make_pass_forwprop ( gcc::context * ctxt)

◆ narrow_vec_perm_simplify_seq()

static void narrow_vec_perm_simplify_seq ( const vec_perm_simplify_seq & seq)
static

◆ optimize_count_trailing_zeroes()

static bool optimize_count_trailing_zeroes ( tree array_ref,
tree x,
tree mulc,
tree tshift,
HOST_WIDE_INT & zero_val )
static
Recognize count trailing zeroes idiom.
The canonical form is array[((x & -x) * C) >> SHIFT] where C is a magic
constant which when multiplied by a power of 2 creates a unique value
in the top 5 or 6 bits.  This is then indexed into a table which maps it
to the number of trailing zeroes.  Array[0] is returned so the caller can
emit an appropriate sequence depending on whether ctz (0) is defined on
the target.   

References array_ref_low_bound(), CHAR_TYPE_SIZE, check_ctz_array(), check_ctz_string(), ctor_for_folding(), direct_internal_fn_supported_p(), gcc_assert, integer_zerop(), OPTIMIZE_FOR_BOTH, TREE_CODE, TREE_OPERAND, tree_to_shwi(), tree_to_uhwi(), TREE_TYPE, TYPE_PRECISION, TYPE_SIZE, and TYPE_UNSIGNED.

Referenced by simplify_count_trailing_zeroes().

◆ optimize_vector_load()

◆ prepare_target_mem_ref_lvalue()

static tree prepare_target_mem_ref_lvalue ( tree ref,
gimple_stmt_iterator * gsi )
static
Prepare a TARGET_MEM_REF ref so that it can be subsetted as
lvalue.  This splits out an address computation stmt before *GSI
and returns a MEM_REF wrapping the address.   

References build1(), build2_loc(), build_int_cst(), build_pointer_type(), EXPR_LOCATION, gimple_build_assign(), gsi_insert_before(), GSI_SAME_STMT, make_ssa_name(), mark_addressable(), TREE_CODE, TREE_OPERAND, TREE_TYPE, and unshare_expr().

Referenced by optimize_vector_load().

◆ process_vec_perm_simplify_seq_list()

static void process_vec_perm_simplify_seq_list ( vec< vec_perm_simplify_seq > * l)
static
Try to blend narrowed vec_perm_simplify_seqs pairwise.
The provided list will be empty after this call.   

References blend_vec_perm_simplify_seqs(), calc_perm_vec_perm_simplify_seqs(), can_blend_vec_perm_simplify_seqs_p(), dump_file, dump_flags, FOR_EACH_VEC_ELT, FOR_EACH_VEC_ELT_FROM, i, narrow_vec_perm_simplify_seq(), and TDF_DETAILS.

Referenced by append_vec_perm_simplify_seq_list().

◆ recognise_vec_perm_simplify_seq()

static bool recognise_vec_perm_simplify_seq ( gassign * stmt,
vec_perm_simplify_seq * seq )
static
Search for opportunities to free half of the lanes in the following pattern:

  v_in = {e0, e1, e2, e3}
  v_1 = VEC_PERM <v_in, v_in, {0, 2, 0, 2}>
  // v_1 = {e0, e2, e0, e2}
  v_2 = VEC_PERM <v_in, v_in, {1, 3, 1, 3}>
  // v_2 = {e1, e3, e1, e3}

  v_x = v_1 + v_2
  // v_x = {e0+e1, e2+e3, e0+e1, e2+e3}
  v_y = v_1 - v_2
  // v_y = {e0-e1, e2-e3, e0-e1, e2-e3}

  v_out = VEC_PERM <v_x, v_y, {0, 1, 6, 7}>
  // v_out = {e0+e1, e2+e3, e0-e1, e2-e3}

The last statement could be simplified to:
  v_out' = VEC_PERM <v_x, v_y, {0, 1, 4, 5}>
  // v_out' = {e0+e1, e2+e3, e0-e1, e2-e3}

Characteristic properties:
- v_1 and v_2 are created from the same input vector v_in and introduce the
  lane duplication (in the selection operand) that we can eliminate.
- v_x and v_y are results from lane-preserving operations that use v_1 and
  v_2 as inputs.
- v_out is created by selecting from duplicated lanes.   

References can_vec_perm_const_p(), commutative_tree_code(), dump_file, dump_flags, dyn_cast(), gcc_checking_assert, gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs3(), gimple_assign_rhs_code(), gimple_bb(), has_single_use(), i, _vec_perm_simplify_seq::nelts, num_imm_uses(), print_generic_expr(), print_gimple_stmt(), SSA_NAME_DEF_STMT, _vec_perm_simplify_seq::stmt, tcc_binary, TDF_DETAILS, TREE_CODE, TREE_CODE_CLASS, TREE_INT_CST_LOW, TREE_TYPE, TYPE_MODE, _vec_perm_simplify_seq::v_1_stmt, _vec_perm_simplify_seq::v_2_stmt, _vec_perm_simplify_seq::v_x_stmt, _vec_perm_simplify_seq::v_y_stmt, vect_gen_perm_mask_checked(), VECTOR_CST_ELT, and VECTOR_CST_NELTS.

◆ remove_prop_source_from_use()

static bool remove_prop_source_from_use ( tree name)
static
Remove a chain of dead statements starting at the definition of
NAME.  The chain is linked via the first operand of the defining statements.
If NAME was replaced in its only use then this function can be used
to clean up dead stmts.  The function handles already released SSA
names gracefully.
Returns true if cleanup-cfg has to run.   

References bitmap_set_bit, cfg_changed, fwprop_invalidate_lattice(), gimple_assign_rhs1(), gimple_bb(), gimple_get_lhs(), gimple_has_side_effects(), gsi_for_stmt(), gsi_remove(), has_zero_uses(), basic_block_def::index, is_gimple_assign(), NULL_TREE, release_defs(), SSA_NAME_DEF_STMT, SSA_NAME_IN_FREE_LIST, SSA_NAME_IS_DEFAULT_DEF, _vec_perm_simplify_seq::stmt, to_purge, TREE_CODE, and unlink_stmt_vdef().

Referenced by forward_propagate_into_comparison(), forward_propagate_into_gimple_cond(), and simplify_permutation().

◆ rhs_to_tree()

static tree rhs_to_tree ( tree type,
gimple * stmt )
static
Return the rhs of a gassign *STMT in a form of a single tree,
converted to type TYPE.

This should disappear, but is needed so we can combine expressions and use
the fold() interfaces. Long term, we need to develop folding and combine
routines that deal with gimple exclusively .  

References build1(), fold_build2_loc(), fold_build3_loc(), gcc_unreachable, get_gimple_rhs_class(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs3(), gimple_assign_rhs_code(), GIMPLE_BINARY_RHS, gimple_location(), GIMPLE_SINGLE_RHS, GIMPLE_TERNARY_RHS, GIMPLE_UNARY_RHS, and _vec_perm_simplify_seq::stmt.

Referenced by forward_propagate_into_comparison_1().

◆ simplify_bitfield_ref()

◆ simplify_builtin_call()

static bool simplify_builtin_call ( gimple_stmt_iterator * gsi_p,
tree callee2 )
static
*GSI_P is a GIMPLE_CALL to a builtin function.
Optimize
memcpy (p, "abcd", 4);
memset (p + 4, ' ', 3);
into
memcpy (p, "abcd   ", 7);
call if the latter can be stored by pieces during expansion.

Optimize
memchr ("abcd", a, 4) == 0;
or
memchr ("abcd", a, 4) != 0;
to
(a == 'a' || a == 'b' || a == 'c' || a == 'd') == 0
or
(a == 'a' || a == 'b' || a == 'c' || a == 'd') != 0

Also canonicalize __atomic_fetch_op (p, x, y) op x
to __atomic_op_fetch (p, x, y) or
__atomic_op_fetch (p, x, y) iop x
to __atomic_fetch_op (p, x, y) when possible (also __sync).   

References a, as_a(), boolean_type_node, build2(), build_fold_addr_expr, build_int_cst(), build_string_literal(), build_zero_cst(), BUILT_IN_NORMAL, builtin_decl_explicit(), builtin_strncpy_read_str(), can_store_by_pieces(), CASE_ATOMIC, CHAR_BIT, char_type_node, compare_tree_int(), COMPARISON_CLASS_P, constant_pointer_difference(), DECL_FUNCTION_CODE(), END_BUILTINS, fndecl_built_in_p(), fold_build2_loc(), fold_convert, fold_convert_loc(), FOR_EACH_IMM_USE_STMT, force_gimple_operand_gsi(), fwprop_invalidate_lattice(), g, gcc_assert, gcc_checking_assert, gcc_unreachable, get_pointer_alignment(), gimple_assign_cast_p(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_class(), gimple_assign_rhs_code(), gimple_assign_set_rhs1(), gimple_assign_set_rhs2(), gimple_assign_set_rhs_with_ops(), gimple_assign_single_p(), gimple_bb(), GIMPLE_BINARY_RHS, gimple_build_assign(), gimple_build_nop(), gimple_call_arg(), gimple_call_fndecl(), gimple_call_lhs(), gimple_call_num_args(), gimple_call_set_arg(), gimple_call_set_fndecl(), gimple_call_set_fntype(), gimple_call_set_lhs(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_cond_set_lhs(), gimple_cond_set_rhs(), gimple_debug_bind_reset_value(), gimple_get_lhs(), gimple_location(), gimple_vdef(), gimple_vuse(), gimplify_and_update_call_from_tree(), gsi_for_stmt(), gsi_insert_after(), GSI_NEW_STMT, gsi_remove(), gsi_replace(), GSI_SAME_STMT, gsi_stmt(), i, INTEGRAL_TYPE_P, is_gimple_assign(), is_gimple_call(), is_gimple_debug(), is_gimple_val(), make_ssa_name(), wi::neg(), NULL, NULL_TREE, operand_equal_p(), optimize_bb_for_speed_p(), release_defs(), release_ssa_name(), rtl_profile_for_bb(), single_imm_use(), size_binop, size_one_node, size_zero_node, sizetype, SSA_NAME_DEF_STMT, stmt_ends_bb_p(), string_constant(), STRIP_USELESS_TYPE_CONVERSION, wi::to_wide(), TREE_CODE, tree_fits_shwi_p(), tree_fits_uhwi_p(), tree_int_cst_lt(), TREE_OPERAND, TREE_STRING_LENGTH, TREE_STRING_POINTER, tree_to_shwi(), tree_to_uhwi(), TREE_TYPE, TYPE_MODE, TYPE_PRECISION, unlink_stmt_vdef(), update_stmt(), use_in_zero_equality(), and useless_type_conversion_p().

◆ simplify_count_trailing_zeroes()

◆ simplify_gimple_switch()

static bool simplify_gimple_switch ( gswitch * stmt,
vec< std::pair< int, int > > & edges_to_remove )
static

◆ simplify_gimple_switch_label_vec()

static void simplify_gimple_switch_label_vec ( gswitch * stmt,
tree index_type,
vec< std::pair< int, int > > & edges_to_remove )
static

◆ simplify_permutation()

◆ simplify_rotate()

static bool simplify_rotate ( gimple_stmt_iterator * gsi)
static
Recognize rotation patterns.  Return true if a transformation
applied, otherwise return false.

We are looking for X with unsigned type T with bitsize B, OP being
+, | or ^, some type T2 wider than T.  For:
(X << CNT1) OP (X >> CNT2)                              iff CNT1 + CNT2 == B
((T) ((T2) X << CNT1)) OP ((T) ((T2) X >> CNT2))        iff CNT1 + CNT2 == B

transform these into:
X r<< CNT1

Or for:
(X << Y) OP (X >> (B - Y))
(X << (int) Y) OP (X >> (int) (B - Y))
((T) ((T2) X << Y)) OP ((T) ((T2) X >> (B - Y)))
((T) ((T2) X << (int) Y)) OP ((T) ((T2) X >> (int) (B - Y)))
(X << Y) | (X >> ((-Y) & (B - 1)))
(X << (int) Y) | (X >> (int) ((-Y) & (B - 1)))
((T) ((T2) X << Y)) | ((T) ((T2) X >> ((-Y) & (B - 1))))
((T) ((T2) X << (int) Y)) | ((T) ((T2) X >> (int) ((-Y) & (B - 1))))

transform these into (last 2 only if ranger can prove Y < B
or Y = N * B):
X r<< Y
or
X r<< (& & (B - 1))
The latter for the forms with T2 wider than T if ranger can't prove Y < B.

Or for:
(X << (Y & (B - 1))) | (X >> ((-Y) & (B - 1)))
(X << (int) (Y & (B - 1))) | (X >> (int) ((-Y) & (B - 1)))
((T) ((T2) X << (Y & (B - 1)))) | ((T) ((T2) X >> ((-Y) & (B - 1))))
((T) ((T2) X << (int) (Y & (B - 1)))) \
  | ((T) ((T2) X >> (int) ((-Y) & (B - 1))))

transform these into:
X r<< (Y & (B - 1))

Note, in the patterns with T2 type, the type of OP operands
might be even a signed type, but should have precision B.
Expressions with & (B - 1) should be recognized only if B is
a power of 2.   

References build_int_cst(), cfun, CONVERT_EXPR_CODE_P, defcodefor_name(), enable_ranger(), floor_log2(), wide_int_storage::from(), g, get_global_range_query(), get_range_query(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_build_assign(), gsi_insert_before(), gsi_replace(), GSI_SAME_STMT, gsi_stmt(), has_single_use(), i, INTEGRAL_TYPE_P, make_ssa_name(), MIN, NULL, NULL_TREE, operand_equal_for_phi_arg_p(), pow2p_hwi(), r, range_query::range_of_expr(), SSA_NAME_DEF_STMT, _vec_perm_simplify_seq::stmt, TREE_CODE, tree_fits_shwi_p(), tree_fits_uhwi_p(), tree_to_shwi(), tree_to_uhwi(), TREE_TYPE, type_has_mode_precision_p(), TYPE_PRECISION, TYPE_SIGN, TYPE_UNSIGNED, types_compatible_p(), irange::union_(), and useless_type_conversion_p().

◆ simplify_vector_constructor()

◆ tidy_after_forward_propagate_addr()

static void tidy_after_forward_propagate_addr ( gimple * stmt)
static
We've just substituted an ADDR_EXPR into stmt.  Update all the
relevant data structures to match.   

References bitmap_set_bit, gimple_assign_rhs1(), gimple_bb(), maybe_clean_or_replace_eh_stmt(), recompute_tree_invariant_for_addr_expr(), _vec_perm_simplify_seq::stmt, to_purge, and TREE_CODE.

Referenced by forward_propagate_addr_expr_1().

Variable Documentation

◆ cfg_changed

◆ lattice

◆ to_purge