aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.osdl.org>2003-08-03 00:15:11 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:01:01 -0700
commitf1b667d4e39d47052211931167bf4f5bd616e820 (patch)
tree98ba5a4ca5e1ce0e2a0f5d9b77af5d5a55dbaa3c /show-parse.c
parentAdd a note in the readme about the fact that we now do a five- (diff)
downloadsparse-f1b667d4e39d47052211931167bf4f5bd616e820.tar.gz
sparse-f1b667d4e39d47052211931167bf4f5bd616e820.tar.bz2
sparse-f1b667d4e39d47052211931167bf4f5bd616e820.zip
Disable premature dead code removal: a block that
is unreachable from the top might still be reachable through a label inside of it.
Diffstat (limited to 'show-parse.c')
-rw-r--r--show-parse.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/show-parse.c b/show-parse.c
index 75501ec..0d7084b 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -435,6 +435,8 @@ int show_statement(struct statement *stmt)
int val, target;
struct expression *cond = stmt->if_conditional;
+/* This is only valid if nobody can jump into the "dead" statement */
+#if 0
if (cond->type == EXPR_VALUE) {
struct statement *s = stmt->if_true;
if (!cond->value)
@@ -442,6 +444,7 @@ int show_statement(struct statement *stmt)
show_statement(s);
break;
}
+#endif
val = show_expression(cond);
target = new_label();
printf("\tje\t\tv%d,.L%d\n", val, target);
@@ -477,9 +480,10 @@ int show_statement(struct statement *stmt)
show_statement(pre_statement);
if (pre_condition) {
if (pre_condition->type == EXPR_VALUE) {
- if (!pre_condition->value)
- break;
- pre_condition = NULL;
+ if (!pre_condition->value) {
+ loop_bottom = new_label();
+ printf("\tjmp\t\t.L%d\n", loop_bottom);
+ }
} else {
loop_bottom = new_label();
val = show_expression(pre_condition);
@@ -505,7 +509,7 @@ int show_statement(struct statement *stmt)
}
if (stmt->iterator_break->used)
printf(".L%p:\n", stmt->iterator_break);
- if (pre_condition)
+ if (loop_bottom)
printf(".L%d:\n", loop_bottom);
break;
}