The remove_empty_blocks function must be used for a pre-walker, otherwise
it might be called on blocks, which were optimized away. Consider infinite
loops and the Keep edges:
\ ___
B |
\ /
Empty
/
/ Keep Edge!
In this example, we must not call remove_empty_blocks on Empty,
after we called it on B, but a post walker would do that.
- * Post-Block walker: remove empty blocks that are
+ * Pre-Block walker: remove empty blocks that are
* predecessors of the current block.
*/
static void remove_empty_blocks(ir_node *block, void *x)
* predecessors of the current block.
*/
static void remove_empty_blocks(ir_node *block, void *x)
irg_block_walk_graph(irg, NULL, optimize_ifs, &env);
/* Remove empty blocks */
irg_block_walk_graph(irg, NULL, optimize_ifs, &env);
/* Remove empty blocks */
- irg_block_walk_graph(irg, NULL, remove_empty_blocks, &env);
+ irg_block_walk_graph(irg, remove_empty_blocks, NULL, &env);
if (env.changed) {
set_irg_doms_inconsistent(irg);
/* Removing blocks might enable more Cond optimizations */
if (env.changed) {
set_irg_doms_inconsistent(irg);
/* Removing blocks might enable more Cond optimizations */