#include "tree-dump.h"
#include "langhooks.h"
-static void tree_ssa_phiopt (void);
+static unsigned int tree_ssa_phiopt (void);
static bool conditional_replacement (basic_block, basic_block,
edge, edge, tree, tree, tree);
static bool value_replacement (basic_block, basic_block,
A similar transformation is done for MAX_EXPR. */
-static void
+static unsigned int
tree_ssa_phiopt (void)
{
basic_block bb;
basic_block *bb_order;
unsigned n, i;
+ bool cfgchanged = false;
/* Search every basic block for COND_EXPR we may be able to optimize.
/* Do the replacement of conditional if it can be done. */
if (conditional_replacement (bb, bb1, e1, e2, phi, arg0, arg1))
- ;
+ cfgchanged = true;
else if (value_replacement (bb, bb1, e1, e2, phi, arg0, arg1))
- ;
+ cfgchanged = true;
else if (abs_replacement (bb, bb1, e1, e2, phi, arg0, arg1))
- ;
- else
- minmax_replacement (bb, bb1, e1, e2, phi, arg0, arg1);
+ cfgchanged = true;
+ else if (minmax_replacement (bb, bb1, e1, e2, phi, arg0, arg1))
+ cfgchanged = true;
}
free (bb_order);
+
+ /* If the CFG has changed, we should cleanup the CFG. */
+ return cfgchanged ? TODO_cleanup_cfg : 0;
}
/* Returns the list of basic blocks in the function in an order that guarantees
/* Eliminate the COND_EXPR at the end of COND_BLOCK. */
bsi = bsi_last (cond_block);
- bsi_remove (&bsi);
+ bsi_remove (&bsi, true);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- TODO_cleanup_cfg
- | TODO_dump_func
+ TODO_dump_func
| TODO_ggc_collect
| TODO_verify_ssa
| TODO_verify_flow