{
struct dom_walk_data walk_data;
unsigned int i;
- struct loops loops_info;
memset (&opt_stats, 0, sizeof (opt_stats));
/* We need to know which edges exit loops so that we can
aggressively thread through loop headers to an exit
edge. */
- flow_loops_find (&loops_info);
- mark_loop_exit_edges (&loops_info);
- flow_loops_free (&loops_info);
+ loop_optimizer_init (0);
+ if (current_loops)
+ {
+ mark_loop_exit_edges ();
+ loop_optimizer_finalize ();
+ }
/* Clean up the CFG so that any forwarder blocks created by loop
canonicalization are removed. */
{
case LT_EXPR:
case GT_EXPR:
- edge_info->max_cond_equivalences = 12;
- edge_info->cond_equivalences = XNEWVEC (tree, 12);
+ if (FLOAT_TYPE_P (TREE_TYPE (op0)))
+ {
+ edge_info->max_cond_equivalences = 12;
+ edge_info->cond_equivalences = XNEWVEC (tree, 12);
+ build_and_record_new_cond (ORDERED_EXPR, op0, op1,
+ &edge_info->cond_equivalences[8]);
+ build_and_record_new_cond (LTGT_EXPR, op0, op1,
+ &edge_info->cond_equivalences[10]);
+ }
+ else
+ {
+ edge_info->max_cond_equivalences = 8;
+ edge_info->cond_equivalences = XNEWVEC (tree, 8);
+ }
+
build_and_record_new_cond ((TREE_CODE (cond) == LT_EXPR
? LE_EXPR : GE_EXPR),
op0, op1, &edge_info->cond_equivalences[4]);
- build_and_record_new_cond (ORDERED_EXPR, op0, op1,
- &edge_info->cond_equivalences[6]);
build_and_record_new_cond (NE_EXPR, op0, op1,
- &edge_info->cond_equivalences[8]);
- build_and_record_new_cond (LTGT_EXPR, op0, op1,
- &edge_info->cond_equivalences[10]);
+ &edge_info->cond_equivalences[6]);
break;
case GE_EXPR:
case LE_EXPR:
- edge_info->max_cond_equivalences = 6;
- edge_info->cond_equivalences = XNEWVEC (tree, 6);
- build_and_record_new_cond (ORDERED_EXPR, op0, op1,
- &edge_info->cond_equivalences[4]);
+ if (FLOAT_TYPE_P (TREE_TYPE (op0)))
+ {
+ edge_info->max_cond_equivalences = 6;
+ edge_info->cond_equivalences = XNEWVEC (tree, 6);
+ build_and_record_new_cond (ORDERED_EXPR, op0, op1,
+ &edge_info->cond_equivalences[4]);
+ }
+ else
+ {
+ edge_info->max_cond_equivalences = 4;
+ edge_info->cond_equivalences = XNEWVEC (tree, 4);
+ }
break;
case EQ_EXPR:
- edge_info->max_cond_equivalences = 10;
- edge_info->cond_equivalences = XNEWVEC (tree, 10);
- build_and_record_new_cond (ORDERED_EXPR, op0, op1,
- &edge_info->cond_equivalences[4]);
+ if (FLOAT_TYPE_P (TREE_TYPE (op0)))
+ {
+ edge_info->max_cond_equivalences = 10;
+ edge_info->cond_equivalences = XNEWVEC (tree, 10);
+ build_and_record_new_cond (ORDERED_EXPR, op0, op1,
+ &edge_info->cond_equivalences[8]);
+ }
+ else
+ {
+ edge_info->max_cond_equivalences = 8;
+ edge_info->cond_equivalences = XNEWVEC (tree, 8);
+ }
build_and_record_new_cond (LE_EXPR, op0, op1,
- &edge_info->cond_equivalences[6]);
+ &edge_info->cond_equivalences[4]);
build_and_record_new_cond (GE_EXPR, op0, op1,
- &edge_info->cond_equivalences[8]);
+ &edge_info->cond_equivalences[6]);
break;
case UNORDERED_EXPR:
{
use_operand_p use_p;
imm_use_iterator iter;
+ tree use_stmt;
bool all = true;
/* Dump details. */
/* Walk over every use of LHS and try to replace the use with RHS.
At this point the only reason why such a propagation would not
be successful would be if the use occurs in an ASM_EXPR. */
- repeat:
- FOR_EACH_IMM_USE_SAFE (use_p, iter, lhs)
+ FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)
{
- tree use_stmt = USE_STMT (use_p);
/* It's not always safe to propagate into an ASM_EXPR. */
if (TREE_CODE (use_stmt) == ASM_EXPR
}
/* Propagate the RHS into this use of the LHS. */
- propagate_value (use_p, rhs);
+ FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
+ propagate_value (use_p, rhs);
/* Special cases to avoid useless calls into the folding
routines, operand scanning, etc.
}
}
- /* Due to a bug in the immediate use iterator code, we can
- miss visiting uses in some cases when there is more than
- one use in a statement. Missing a use can cause a multitude
- of problems if we expected to eliminate all uses and remove
- the defining statement.
-
- Until Andrew can fix the iterator, this hack will detect
- the cases which cause us problems. Namely if ALL is set
- and we still have some immediate uses, then we must have
- skipped one or more in the loop above. So just re-execute
- the loop.
-
- The maximum number of times we can re-execute the loop is
- bounded by the maximum number of times a given SSA_NAME
- appears in a single statement. */
- if (all && num_imm_uses (lhs) != 0)
- goto repeat;
+ /* Ensure there is nothing else to do. */
+ gcc_assert (!all || has_zero_uses (lhs));
/* If we were able to propagate away all uses of LHS, then
we can remove STMT. */
A set bit indicates that the statement or PHI node which
defines the SSA_NAME should be (re)examined to determine if
- it has become a degenerate PHI or trival const/copy propagation
+ it has become a degenerate PHI or trivial const/copy propagation
opportunity.
Experiments have show we generally get better compilation