use default error handler if none is specified
[libfirm] / ir / opt / cfopt.c
index adaa810..e9497a5 100644 (file)
@@ -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"
 
@@ -788,17 +786,19 @@ restart:
                ir_node *ka = get_End_keepalive(end, i);
 
                if (!irn_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 (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;
                        }
                }