* tree-ssa.h: Don't include tree-ssa-dom.h.
* tree-ssa-dom.c: Include tree-ssa-dom.h.
(degenerate_phi_result): Move to tree-phinodes.c.
* tree-phinodes.c (degenerate_phi_result): Relocate here.
* tree-ssa-dom.h: Remove Prototype.
* tree-phinodes.h: Add prototype.
* tree-ssa-copy.c: Include tree-ssa-dom.h.
* tree-ssa-forwprop.c: Likewise.
*************** along with GCC; see the file COPYING3.
#include "tree-phinodes.h"
#include "ssa-iterators.h"
#include "tree-ssanames.h"
- #include "tree-ssa-dom.h"
#include "tree-ssa-loop.h"
#include "tree-into-ssa.h"
#include "tree-dfa.h"
*************** along with GCC; see the file COPYING3.
#include "langhooks.h"
#include "params.h"
#include "tree-ssa-threadedge.h"
+ #include "tree-ssa-dom.h"
/* This file implements optimizations on the dominator tree. */
*************** avail_expr_hash (const void *p)
/* PHI-ONLY copy and constant propagation. This pass is meant to clean
up degenerate PHIs created by or exposed by jump threading. */
- /* Given PHI, return its RHS if the PHI is a degenerate, otherwise return
- NULL. */
-
- tree
- degenerate_phi_result (gimple phi)
- {
- tree lhs = gimple_phi_result (phi);
- tree val = NULL;
- size_t i;
-
- /* Ignoring arguments which are the same as LHS, if all the remaining
- arguments are the same, then the PHI is a degenerate and has the
- value of that common argument. */
- for (i = 0; i < gimple_phi_num_args (phi); i++)
- {
- tree arg = gimple_phi_arg_def (phi, i);
-
- if (arg == lhs)
- continue;
- else if (!arg)
- break;
- else if (!val)
- val = arg;
- else if (arg == val)
- continue;
- /* We bring in some of operand_equal_p not only to speed things
- up, but also to avoid crashing when dereferencing the type of
- a released SSA name. */
- else if (TREE_CODE (val) != TREE_CODE (arg)
- || TREE_CODE (val) == SSA_NAME
- || !operand_equal_p (arg, val, 0))
- break;
- }
- return (i == gimple_phi_num_args (phi) ? val : NULL);
- }
-
/* Given a statement STMT, which is either a PHI node or an assignment,
remove it from the IL. */
*************** remove_phi_nodes (basic_block bb)
set_phi_nodes (bb, NULL);
}
+ /* Given PHI, return its RHS if the PHI is a degenerate, otherwise return
+ NULL. */
+
+ tree
+ degenerate_phi_result (gimple phi)
+ {
+ tree lhs = gimple_phi_result (phi);
+ tree val = NULL;
+ size_t i;
+
+ /* Ignoring arguments which are the same as LHS, if all the remaining
+ arguments are the same, then the PHI is a degenerate and has the
+ value of that common argument. */
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
+ {
+ tree arg = gimple_phi_arg_def (phi, i);
+
+ if (arg == lhs)
+ continue;
+ else if (!arg)
+ break;
+ else if (!val)
+ val = arg;
+ else if (arg == val)
+ continue;
+ /* We bring in some of operand_equal_p not only to speed things
+ up, but also to avoid crashing when dereferencing the type of
+ a released SSA name. */
+ else if (TREE_CODE (val) != TREE_CODE (arg)
+ || TREE_CODE (val) == SSA_NAME
+ || !operand_equal_p (arg, val, 0))
+ break;
+ }
+ return (i == gimple_phi_num_args (phi) ? val : NULL);
+ }
+
+
#include "gt-tree-phinodes.h"
*************** extern void dump_dominator_optimization_
extern void debug_dominator_optimization_stats (void);
extern int loop_depth_of_name (tree);
extern bool simple_iv_increment_p (gimple);
- extern tree degenerate_phi_result (gimple);
#endif /* GCC_TREE_SSA_DOM_H */
*************** extern void add_phi_arg (gimple, tree, e
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void remove_phi_nodes (basic_block);
! /* Return a use_operand_p pointer for argument I of PHI node GS. */
/* Set PHI nodes of a basic block BB to SEQ. */
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void remove_phi_nodes (basic_block);
! extern tree degenerate_phi_result (gimple);
/* Set PHI nodes of a basic block BB to SEQ. */
*************** along with GCC; see the file COPYING3.
#include "langhooks.h"
#include "cfgloop.h"
#include "tree-scalar-evolution.h"
+ #include "tree-ssa-dom.h"
/* This file implements the copy propagation pass and provides a
handful of interfaces for performing const/copy propagation and
*************** along with GCC; see the file COPYING3.
#include "cfgloop.h"
#include "optabs.h"
#include "tree-ssa-propagate.h"
+ #include "tree-ssa-dom.h"
/* This pass propagates the RHS of assignment statements into use
sites of the LHS of the assignment. It's basically a specialized