summaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-13 04:29:40 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-13 04:29:40 +0000
commit5f718c29c69b083f07d3d234c7e79502c2d1547b (patch)
tree6045fae43be21a314688da828dfd1010938a5ab4 /gcc/tree-cfg.c
parent3bcf2cd545426aea123eaec3aab7417b569a6cc3 (diff)
downloadgcc-5f718c29c69b083f07d3d234c7e79502c2d1547b.tar.gz
* Makefile.in (OBJS-common): Add tree-ssa-uncprop.o.
(tree-ssa-uncprop.o): Add dependencies. * tree-cfg.c (remove_useless_stmts_bb, remove_useless_stmts): Remove. * tree-flow.h (remove_useless_stmts): Remove prototype. * tree-outof-ssa.c (rewrite_out_of_ssa): Remove call to remove_useless_stmts. * timevar.def (TV_TREE_SSA_UNCPROP): New timevar. * tree-optimize.c (init_tree_optimization_passes): Add uncprop pass. * tree-pass.h (pass_uncprop): Declare. * tree-ssa-uncprop.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98066 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c121
1 files changed, 0 insertions, 121 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index a9a9fdcab73..a80285b131f 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1896,127 +1896,6 @@ struct tree_opt_pass pass_remove_useless_stmts =
0 /* letter */
};
-
-/* Remove obviously useless statements in basic block BB. */
-
-static void
-cfg_remove_useless_stmts_bb (basic_block bb)
-{
- block_stmt_iterator bsi;
- tree stmt = NULL_TREE;
- tree cond, var = NULL_TREE, val = NULL_TREE;
- struct var_ann_d *ann;
-
- /* Check whether we come here from a condition, and if so, get the
- condition. */
- if (!single_pred_p (bb)
- || !(single_pred_edge (bb)->flags
- & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE)))
- return;
-
- cond = COND_EXPR_COND (last_stmt (single_pred (bb)));
-
- if (TREE_CODE (cond) == VAR_DECL || TREE_CODE (cond) == PARM_DECL)
- {
- var = cond;
- val = (single_pred_edge (bb)->flags & EDGE_FALSE_VALUE
- ? boolean_false_node : boolean_true_node);
- }
- else if (TREE_CODE (cond) == TRUTH_NOT_EXPR
- && (TREE_CODE (TREE_OPERAND (cond, 0)) == VAR_DECL
- || TREE_CODE (TREE_OPERAND (cond, 0)) == PARM_DECL))
- {
- var = TREE_OPERAND (cond, 0);
- val = (single_pred_edge (bb)->flags & EDGE_FALSE_VALUE
- ? boolean_true_node : boolean_false_node);
- }
- else
- {
- if (single_pred_edge (bb)->flags & EDGE_FALSE_VALUE)
- cond = invert_truthvalue (cond);
- if (TREE_CODE (cond) == EQ_EXPR
- && (TREE_CODE (TREE_OPERAND (cond, 0)) == VAR_DECL
- || TREE_CODE (TREE_OPERAND (cond, 0)) == PARM_DECL)
- && (TREE_CODE (TREE_OPERAND (cond, 1)) == VAR_DECL
- || TREE_CODE (TREE_OPERAND (cond, 1)) == PARM_DECL
- || TREE_CONSTANT (TREE_OPERAND (cond, 1))))
- {
- var = TREE_OPERAND (cond, 0);
- val = TREE_OPERAND (cond, 1);
- }
- else
- return;
- }
-
- /* Only work for normal local variables. */
- ann = var_ann (var);
- if (!ann
- || ann->may_aliases
- || TREE_ADDRESSABLE (var))
- return;
-
- if (! TREE_CONSTANT (val))
- {
- ann = var_ann (val);
- if (!ann
- || ann->may_aliases
- || TREE_ADDRESSABLE (val))
- return;
- }
-
- /* Ignore floating point variables, since comparison behaves weird for
- them. */
- if (FLOAT_TYPE_P (TREE_TYPE (var)))
- return;
-
- for (bsi = bsi_start (bb); !bsi_end_p (bsi);)
- {
- stmt = bsi_stmt (bsi);
-
- /* If the THEN/ELSE clause merely assigns a value to a variable/parameter
- which is already known to contain that value, then remove the useless
- THEN/ELSE clause. */
- if (TREE_CODE (stmt) == MODIFY_EXPR
- && TREE_OPERAND (stmt, 0) == var
- && operand_equal_p (val, TREE_OPERAND (stmt, 1), 0))
- {
- bsi_remove (&bsi);
- continue;
- }
-
- /* Invalidate the var if we encounter something that could modify it.
- Likewise for the value it was previously set to. Note that we only
- consider values that are either a VAR_DECL or PARM_DECL so we
- can test for conflict very simply. */
- if (TREE_CODE (stmt) == ASM_EXPR
- || (TREE_CODE (stmt) == MODIFY_EXPR
- && (TREE_OPERAND (stmt, 0) == var
- || TREE_OPERAND (stmt, 0) == val)))
- return;
-
- bsi_next (&bsi);
- }
-}
-
-
-/* A CFG-aware version of remove_useless_stmts. */
-
-void
-cfg_remove_useless_stmts (void)
-{
- basic_block bb;
-
-#ifdef ENABLE_CHECKING
- verify_flow_info ();
-#endif
-
- FOR_EACH_BB (bb)
- {
- cfg_remove_useless_stmts_bb (bb);
- }
-}
-
-
/* Remove PHI nodes associated with basic block BB and all edges out of BB. */
static void