Commit fef0657c by Jeff Law Committed by Jeff Law

Makefile.in (OBJS-common): Add tree-ssa-uncprop.o.


	* 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.

From-SVN: r98066
parent 6dab073b
2005-04-12 Jeff Law <law@redhat.com>
* 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.
2005-04-12 James E. Wilson <wilson@specifixinc.com>
PR target/20670
......
......@@ -924,7 +924,7 @@ OBJS-common = \
tree-chrec.o tree-scalar-evolution.o tree-data-ref.o \
tree-cfg.o tree-dfa.o tree-eh.o tree-ssa.o tree-optimize.o tree-gimple.o \
gimplify.o tree-pretty-print.o tree-into-ssa.o \
tree-outof-ssa.o tree-ssa-ccp.o tree-vn.o \
tree-outof-ssa.o tree-ssa-ccp.o tree-vn.o tree-ssa-uncprop.o \
tree-ssa-dce.o tree-ssa-copy.o tree-nrv.o tree-ssa-copyrename.o \
tree-ssa-pre.o tree-ssa-live.o tree-ssa-operands.o tree-ssa-alias.o \
tree-ssa-phiopt.o tree-ssa-forwprop.o tree-nested.o tree-ssa-dse.o \
......@@ -1666,6 +1666,11 @@ tree-ssa-dom.o : tree-ssa-dom.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
errors.h function.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
$(BASIC_BLOCK_H) domwalk.h real.h tree-pass.h $(FLAGS_H) langhooks.h \
tree-ssa-propagate.h cfgloop.h
tree-ssa-uncprop.o : tree-ssa-uncprop.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h diagnostic.h \
errors.h function.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
$(BASIC_BLOCK_H) domwalk.h real.h tree-pass.h $(FLAGS_H) langhooks.h \
tree-ssa-propagate.h cfgloop.h
tree-ssa-threadupdate.o : tree-ssa-threadupdate.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h \
diagnostic.h errors.h function.h $(TM_H) coretypes.h $(TREE_DUMP_H) \
......
......@@ -103,6 +103,7 @@ DEFTIMEVAR (TV_TREE_LOOP_IVOPTS , "tree iv optimization")
DEFTIMEVAR (TV_TREE_LOOP_INIT , "tree loop init")
DEFTIMEVAR (TV_TREE_LOOP_FINI , "tree loop fini")
DEFTIMEVAR (TV_TREE_CH , "tree copy headers")
DEFTIMEVAR (TV_TREE_SSA_UNCPROP , "tree SSA uncprop")
DEFTIMEVAR (TV_TREE_SSA_TO_NORMAL , "tree SSA to normal")
DEFTIMEVAR (TV_TREE_NRV , "tree NRV optimization")
DEFTIMEVAR (TV_TREE_COPY_RENAME , "tree rename SSA copies")
......
......@@ -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
......
......@@ -522,7 +522,6 @@ extern tree last_stmt (basic_block);
extern tree *last_stmt_ptr (basic_block);
extern tree last_and_only_stmt (basic_block);
extern edge find_taken_edge (basic_block, tree);
extern void cfg_remove_useless_stmts (void);
extern basic_block label_to_block_fn (struct function *, tree);
#define label_to_block(t) (label_to_block_fn (cfun, t))
extern void bsi_insert_on_edge (edge, tree);
......
......@@ -407,6 +407,7 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_phiopt);
NEXT_PASS (pass_tail_calls);
NEXT_PASS (pass_rename_ssa_copies);
NEXT_PASS (pass_uncprop);
NEXT_PASS (pass_del_ssa);
NEXT_PASS (pass_nrv);
NEXT_PASS (pass_remove_useless_vars);
......
......@@ -2508,10 +2508,6 @@ rewrite_out_of_ssa (void)
if (dump_file && (dump_flags & TDF_DETAILS))
dump_tree_cfg (dump_file, dump_flags & ~TDF_DETAILS);
/* Do some cleanups which reduce the amount of data the
tree->rtl expanders deal with. */
cfg_remove_useless_stmts ();
/* Flush out flow graph and SSA data. */
delete_var_map (map);
......
......@@ -212,5 +212,6 @@ extern struct tree_opt_pass pass_store_ccp;
extern struct tree_opt_pass pass_store_copy_prop;
extern struct tree_opt_pass pass_vrp;
extern struct tree_opt_pass pass_create_structure_vars;
extern struct tree_opt_pass pass_uncprop;
#endif /* GCC_TREE_PASS_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment