GCC Middle and Back End API Reference
tree-ssa-dom.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "tree-pass.h"
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "fold-const.h"
#include "cfganal.h"
#include "cfgloop.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "tree-inline.h"
#include "tree-cfg.h"
#include "tree-into-ssa.h"
#include "domwalk.h"
#include "tree-ssa-propagate.h"
#include "tree-ssa-threadupdate.h"
#include "tree-ssa-scopedtables.h"
#include "tree-ssa-threadedge.h"
#include "tree-ssa-dom.h"
#include "tree-cfgcleanup.h"
#include "dbgcnt.h"
#include "alloc-pool.h"
#include "tree-vrp.h"
#include "vr-values.h"
#include "gimple-range.h"
#include "gimple-range-path.h"
#include "alias.h"
Include dependency graph for tree-ssa-dom.cc:

Data Structures

class  edge_info
struct  opt_stats_d
class  dom_jt_state
class  dom_jt_simplifier
class  dom_opt_dom_walker

Functions

static void record_equality (tree, tree, class const_and_copies *)
static void record_equivalences_from_phis (basic_block)
static void dump_dominator_optimization_stats (FILE *file, hash_table< expr_elt_hasher > *)
static void record_temporary_equivalences (edge, class const_and_copies *, class avail_exprs_stack *, bitmap)
void free_dom_edge_info (edge e)
static void free_all_edge_infos (void)
static void record_edge_info (basic_block bb)
gimple_opt_pass * make_pass_dominator (gcc::context *ctxt)
static tree dom_valueize (tree t)
static void back_propagate_equivalences (tree lhs, edge e, class const_and_copies *const_and_copies, bitmap domby)
static bool all_uses_feed_or_dominated_by_stmt (tree name, gimple *stmt)
static void maybe_set_nonzero_bits (edge e, tree var)
static void htab_statistics (FILE *file, const hash_table< expr_elt_hasher > &htab)
bool simple_iv_increment_p (gimple *stmt)
static void cprop_into_successor_phis (basic_block bb, class const_and_copies *const_and_copies)
static void cprop_operand (gimple *stmt, use_operand_p op_p, range_query *query)
static void cprop_into_stmt (gimple *stmt, range_query *query)
static void reduce_vector_comparison_to_scalar_comparison (gimple *stmt)

Variables

static bool cfg_altered
static bitmap need_eh_cleanup
static vec< gimple * > need_noreturn_fixup
static bitmap names_without_foldable_uses
static struct opt_stats_d opt_stats

Function Documentation

◆ all_uses_feed_or_dominated_by_stmt()

bool all_uses_feed_or_dominated_by_stmt ( tree name,
gimple * stmt )
static

◆ back_propagate_equivalences()

void back_propagate_equivalences ( tree lhs,
edge e,
class const_and_copies * const_and_copies,
bitmap domby )
static

◆ cprop_into_stmt()

void cprop_into_stmt ( gimple * stmt,
range_query * query )
static
CONST_AND_COPIES is a table which maps an SSA_NAME to the current
known value for that SSA_NAME (or NULL if no value is known).

Propagate values from CONST_AND_COPIES into the uses, vuses and
vdef_ops of STMT.   

References cprop_into_stmt(), cprop_operand(), FOR_EACH_SSA_USE_OPERAND, NULL, SSA_OP_USE, TREE_CODE, and USE_FROM_PTR.

Referenced by cprop_into_stmt(), and dom_opt_dom_walker::optimize_stmt().

◆ cprop_into_successor_phis()

◆ cprop_operand()

◆ dom_valueize()

◆ dump_dominator_optimization_stats()

void dump_dominator_optimization_stats ( FILE * file,
hash_table< expr_elt_hasher > * avail_exprs )
static

◆ free_all_edge_infos()

void free_all_edge_infos ( void )
static
Free all EDGE_INFO structures associated with edges in the CFG.
If a particular edge can be threaded, copy the redirection
target from the EDGE_INFO structure into the edge's AUX field
as required by code to update the CFG and SSA graph for
jump threading.   

References cfun, FOR_EACH_BB_FN, FOR_EACH_EDGE, free_all_edge_infos(), free_dom_edge_info(), and basic_block_def::preds.

Referenced by free_all_edge_infos().

◆ free_dom_edge_info()

void free_dom_edge_info ( edge e)
Free the edge_info data attached to E, if it exists and
clear e->aux.   

References free_dom_edge_info(), and NULL.

Referenced by edge_info::edge_info(), free_all_edge_infos(), free_dom_edge_info(), record_edge_info(), and remove_ctrl_stmt_and_useless_edges().

◆ htab_statistics()

◆ make_pass_dominator()

gimple_opt_pass * make_pass_dominator ( gcc::context * ctxt)

◆ maybe_set_nonzero_bits()

◆ record_edge_info()

◆ record_equality()

void record_equality ( tree x,
tree y,
class const_and_copies * const_and_copies )
static
Local functions.   
Similarly, but assume that X and Y are the two operands of an EQ_EXPR.
This constrains the cases in which we may treat this as assignment.   

References dconst0, has_single_use(), HONOR_SIGNED_ZEROS(), is_gimple_min_invariant(), NULL, real_equal(), const_and_copies::record_const_or_copy(), record_equality(), SSA_NAME_VALUE, TREE_CODE, TREE_REAL_CST, tree_swap_operands_p(), and y.

Referenced by back_propagate_equivalences(), record_equality(), and record_temporary_equivalences().

◆ record_equivalences_from_phis()

◆ record_temporary_equivalences()

void record_temporary_equivalences ( edge e,
class const_and_copies * const_and_copies,
class avail_exprs_stack * avail_exprs_stack,
bitmap blocks_on_stack )
static
Record into CONST_AND_COPIES and AVAIL_EXPRS_STACK any equivalences implied
by traversing edge E (which are cached in E->aux).

Callers are responsible for managing the unwinding markers.   

References back_propagate_equivalences(), edge_info::cond_equivalences, eni_size_weights, estimate_num_insns(), i, avail_exprs_stack::record_cond(), record_equality(), record_temporary_equivalences(), edge_info::simple_equivalences, SSA_NAME_DEF_STMT, and TREE_CODE.

Referenced by dom_opt_dom_walker::record_equivalences_from_incoming_edge(), record_temporary_equivalences(), and dom_jt_state::register_equivs_edge().

◆ reduce_vector_comparison_to_scalar_comparison()

◆ simple_iv_increment_p()

bool simple_iv_increment_p ( gimple * stmt)
Returns true when STMT is a simple iv increment.  It detects the
following situation:

i_1 = phi (..., i_k)
[...]
i_j = i_{j-1}  for each j : 2 <= j <= k-1
[...]
i_k = i_{k-1} +/- ...   
Header file for SSA dominator optimizations.
   Copyright (C) 2013-2026 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   

References gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_assign_ssa_name_copy_p(), gimple_phi_arg_def(), gimple_phi_num_args(), i, simple_iv_increment_p(), SSA_NAME_DEF_STMT, and TREE_CODE.

Referenced by dom_opt_dom_walker::eliminate_redundant_computations(), and simple_iv_increment_p().

Variable Documentation

◆ cfg_altered

bool cfg_altered
static
Track whether or not we have changed the control flow graph.   

Referenced by dom_opt_dom_walker::optimize_stmt().

◆ names_without_foldable_uses

bitmap names_without_foldable_uses
static
Bitmap of SSA names that have no use in an assignment or call that
defines an SSA name, so back_propagate_equivalences has nothing to do
for them.  A bit is cleared when DOM adds such a use.   

Referenced by back_propagate_equivalences(), and dom_opt_dom_walker::before_dom_children().

◆ need_eh_cleanup

bitmap need_eh_cleanup
static
Bitmap of blocks that have had EH statements cleaned.  We should
remove their dead edges eventually.   

Referenced by dom_opt_dom_walker::optimize_stmt().

◆ need_noreturn_fixup

vec<gimple *> need_noreturn_fixup
static

◆ opt_stats