+ /* if all predecessors of a block are unreachable, then the block is
+ * unreachable */
+ if (is_irg_state(irg, IR_GRAPH_STATE_BAD_BLOCK)) {
+ int i;
+ int n_cfgpreds = get_Block_n_cfgpreds(n);
+
+ for (i = 0; i < n_cfgpreds; ++i) {
+ ir_node *pred = get_Block_cfgpred(n, i);
+ if (!is_Bad(pred))
+ break;
+ }
+ /* only bad inputs? It's unreachable code (unless it is the start or
+ * end block) */
+ if (i >= n_cfgpreds && n != get_irg_start_block(irg)
+ && n != get_irg_end_block(irg)) {
+ return get_irg_bad(irg);
+ }
+ }
+