GCC Middle and Back End API Reference
tree-ssa-dse.c File Reference

Functions

static bool gate_dse (void)
static unsigned int tree_ssa_dse (void)
static void dse_enter_block (struct dom_walk_data *, basic_block)
static bool dse_possible_dead_store_p ()
static void dse_optimize_stmt ()
gimple_opt_passmake_pass_dse ()

Variables

static bitmap need_eh_cleanup

Function Documentation

static void dse_enter_block ( struct dom_walk_data walk_data,
basic_block  bb 
)
static
static void dse_optimize_stmt ( )
static
Attempt to eliminate dead stores in the statement referenced by BSI.

   A dead store is a store into a memory location which will later be
   overwritten by another store without any intervening loads.  In this
   case the earlier store can be deleted.

   In our SSA + virtual operand world we use immediate uses of virtual
   operands to detect dead stores.  If a store's virtual definition
   is used precisely once by a later store to the same location which
   post dominates the first store, then the first store is dead.   

References bitmap_set_bit(), dse_possible_dead_store_p(), dump_file, dump_flags, gimple_assign_lhs(), gimple_bb(), gimple_call_fndecl(), gimple_clobber_p(), gimple_get_lhs(), gimple_has_lhs(), gimple_has_volatile_ops(), gimple_vdef(), gsi_remove(), gsi_stmt(), basic_block_def::index, is_gimple_assign(), is_gimple_call(), operand_equal_p(), print_gimple_stmt(), ref_maybe_used_by_stmt_p(), release_defs(), stmt_kills_ref_p(), and unlink_stmt_vdef().

Referenced by dse_enter_block().

static bool dse_possible_dead_store_p ( )
static
A helper of dse_optimize_stmt.
   Given a GIMPLE_ASSIGN in STMT, find a candidate statement *USE_STMT that
   may prove STMT to be dead.
   Return TRUE if the above conditions are met, otherwise FALSE.   

References CDI_DOMINATORS, CDI_POST_DOMINATORS, dominated_by_p(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_vdef(), operand_equal_p(), ref_maybe_used_by_stmt_p(), stmt_may_clobber_global_p(), stmt_may_clobber_ref_p(), and ui.

Referenced by dse_optimize_stmt().

static bool gate_dse ( void  )
static
gimple_opt_pass* make_pass_dse ( )

Variable Documentation

bitmap need_eh_cleanup
static
@verbatim Dead store elimination

Copyright (C) 2004-2013 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/.

This file implements dead store elimination.

   A dead store is a store into a memory location which will later be
   overwritten by another store without any intervening loads.  In this
   case the earlier store can be deleted.

   In our SSA + virtual operand world we use immediate uses of virtual
   operands to detect dead stores.  If a store's virtual definition
   is used precisely once by a later store to the same location which
   post dominates the first store, then the first store is dead.

   The single use of the store's virtual definition ensures that
   there are no intervening aliased loads and the requirement that
   the second load post dominate the first ensures that if the earlier
   store executes, then the later stores will execute before the function
   exits.

   It may help to think of this as first moving the earlier store to
   the point immediately before the later store.  Again, the single
   use of the virtual definition and the post-dominance relationship
   ensure that such movement would be safe.  Clearly if there are
   back to back stores, then the second is redundant.

   Reviewing section 10.7.2 in Morgan's "Building an Optimizing Compiler"
   may also help in understanding this code since it discusses the
   relationship between dead store and redundant load elimination.  In
   fact, they are the same transformation applied to different views of
   the CFG.   
Bitmap of blocks that have had EH statements cleaned.  We should
   remove their dead edges eventually.