int i;
if (TREE_CODE (SSA_NAME_VAR (e)) == PARM_DECL
- && e == default_def (SSA_NAME_VAR (e)))
+ && e == gimple_default_def (cfun, SSA_NAME_VAR (e)))
return find_operand_rank (e)->rank;
stmt = SSA_NAME_DEF_STMT (e);
operand_entry_t last)
{
- /* If we have two of the same op, and the opcode is & or |, we can
- eliminate one of them.
+ /* If we have two of the same op, and the opcode is & |, min, or max,
+ we can eliminate one of them.
If we have two of the same op, and the opcode is ^, we can
eliminate both of them. */
{
switch (opcode)
{
+ case MAX_EXPR:
+ case MIN_EXPR:
case BIT_IOR_EXPR:
case BIT_AND_EXPR:
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Equivalence: ");
print_generic_expr (dump_file, curr->op, 0);
- fprintf (dump_file, " [&|] ");
+ fprintf (dump_file, " [&|minmax] ");
print_generic_expr (dump_file, last->op, 0);
fprintf (dump_file, " -> ");
print_generic_stmt (dump_file, last->op, 0);
&& lang_hooks.types_compatible_p (TREE_TYPE (oelm1->op),
TREE_TYPE (oelast->op)))
{
- tree folded = fold_build2 (opcode, TREE_TYPE (oelm1->op),
+ tree folded = fold_binary (opcode, TREE_TYPE (oelm1->op),
oelm1->op, oelast->op);
- if (is_gimple_min_invariant (folded))
+ if (folded && is_gimple_min_invariant (folded))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Merging constants\n");
if (TREE_CODE (tonegate) == SSA_NAME
&& TREE_CODE (negatedef) == MODIFY_EXPR
&& TREE_CODE (TREE_OPERAND (negatedef, 0)) == SSA_NAME
- && num_imm_uses (TREE_OPERAND (negatedef, 0)) == 1
+ && has_single_use (TREE_OPERAND (negatedef, 0))
&& TREE_CODE (TREE_OPERAND (negatedef, 1)) == PLUS_EXPR)
{
block_stmt_iterator bsi;
/* There may be no immediate uses left by the time we
get here because we may have eliminated them all. */
- if (TREE_CODE (lhs) == SSA_NAME && num_imm_uses (lhs) == 0)
+ if (TREE_CODE (lhs) == SSA_NAME && has_zero_uses (lhs))
continue;
TREE_VISITED (stmt) = 1;
int i;
unsigned int rank = 2;
tree param;
- int *bbs = xmalloc ((last_basic_block + 1) * sizeof (int));
+ int *bbs = XNEWVEC (int, last_basic_block + 1);
memset (&reassociate_stats, 0, sizeof (reassociate_stats));
/* Reverse RPO (Reverse Post Order) will give us something where
deeper loops come later. */
- flow_depth_first_order_compute (NULL, bbs);
- bb_rank = xcalloc (last_basic_block + 1, sizeof (unsigned int));
+ pre_and_rev_post_order_compute (NULL, bbs, false);
+ bb_rank = XCNEWVEC (unsigned int, last_basic_block + 1);
operand_rank = htab_create (511, operand_entry_hash,
operand_entry_eq, 0);
param;
param = TREE_CHAIN (param))
{
- if (default_def (param) != NULL)
+ if (gimple_default_def (cfun, param) != NULL)
{
- tree def = default_def (param);
+ tree def = gimple_default_def (cfun, param);
insert_operand_rank (def, ++rank);
}
}
/* Give the chain decl a distinct rank. */
if (cfun->static_chain_decl != NULL)
{
- tree def = default_def (cfun->static_chain_decl);
+ tree def = gimple_default_def (cfun, cfun->static_chain_decl);
if (def != NULL)
insert_operand_rank (def, ++rank);
}
/* Gate and execute functions for Reassociation. */
-static void
+static unsigned int
execute_reassoc (void)
{
init_reassoc ();
repropagate_negates ();
fini_reassoc ();
+ return 0;
}
struct tree_opt_pass pass_reassoc =