Do not get the break block of a switch before it is sure that a jump there is actuall...
authorChristoph Mallon <christoph.mallon@gmx.de>
Sat, 21 Apr 2012 16:39:22 +0000 (18:39 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Tue, 24 Apr 2012 12:51:59 +0000 (14:51 +0200)
Usually the inner (compound) statement of a switch ends in a break or return, so there is no normal flow out of the switch statement.

ast2firm.c

index ef5b89b..9a96478 100644 (file)
@@ -4996,7 +4996,9 @@ static ir_node *switch_statement_to_firm(switch_statement_t *statement)
 
        statement_to_firm(statement->body);
 
-       jump_if_reachable(get_break_label());
+       if (currently_reachable()) {
+               add_immBlock_pred(get_break_label(), new_Jmp());
+       }
 
        if (!saw_default_label && switch_node) {
                ir_node *proj = new_d_Proj(dbgi, switch_node, mode_X, pn_Switch_default);