X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fcfopt.c;h=e9497a596aeb1c396e8088324048287f8e5cb9c8;hb=04906225f6fe1bc22f73b5d6a98eb9c0992a9b54;hp=65faf63fb523676b53c9831f995f3dacf45752db;hpb=e07b61c6ed5d198a484761f8a40a4f26520d964d;p=libfirm diff --git a/ir/opt/cfopt.c b/ir/opt/cfopt.c index 65faf63fb..e9497a596 100644 --- a/ir/opt/cfopt.c +++ b/ir/opt/cfopt.c @@ -23,9 +23,7 @@ * @author Goetz Lindenmaier, Michael Beck, Sebastian Hack * @version $Id$ */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" #include "iroptimize.h" @@ -165,7 +163,7 @@ static void merge_blocks(ir_node *node, void *ctx) { if (!is_Block_dead(b)) { new_block = equivalent_node(b); - while (irn_not_visited(b) && (!is_Block_dead(new_block)) && (new_block != b)) { + while (!irn_visited(b) && !is_Block_dead(new_block) && new_block != b) { /* We would have to run gigo() if new is bad, so we promote it directly below. Nevertheless, we sometimes reach a block the first time through a dataflow node. In this case we optimized the @@ -787,18 +785,20 @@ restart: for (i = j = 0; i < n; i++) { ir_node *ka = get_End_keepalive(end, i); - if (irn_not_visited(ka)) { - if (is_Block(ka) && !Block_block_visited(ka)) { - /* irg_block_walk() will increase the block visited flag, but we must visit only - these blocks that are not visited yet, so decrease it first. */ - set_irg_block_visited(irg, get_irg_block_visited(irg) - 1); - irg_block_walk(ka, optimize_blocks, remove_simple_blocks, &env.changed); - mark_irn_visited(ka); - in[j++] = ka; + if (!irn_visited(ka)) { + if (is_Block(ka)) { + if (!Block_block_visited(ka)) { + /* irg_block_walk() will increase the block visited flag, but we must visit only + these blocks that are not visited yet, so decrease it first. */ + set_irg_block_visited(irg, get_irg_block_visited(irg) - 1); + irg_block_walk(ka, optimize_blocks, remove_simple_blocks, &env.changed); + mark_irn_visited(ka); + in[j++] = ka; + } } else { mark_irn_visited(ka); /* don't keep alive dead blocks */ - if (! is_Block_dead(get_nodes_block(ka))) + if (!is_Bad(ka) && !is_Block_dead(get_nodes_block(ka))) in[j++] = ka; } }