aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-04-23 12:24:49 +0200
committerJosh Triplett <josh@freedesktop.org>2008-04-24 19:33:16 -0700
commit6dcc36aec041ea5bb4b8d013d97aaa60d51c18df (patch)
tree83b025f7c0f014ecfb5279cae0f797d08465669d /linearize.h
parentSimplify (and warn about) right shifts that result in zero (diff)
downloadsparse-6dcc36aec041ea5bb4b8d013d97aaa60d51c18df.tar.gz
sparse-6dcc36aec041ea5bb4b8d013d97aaa60d51c18df.tar.bz2
sparse-6dcc36aec041ea5bb4b8d013d97aaa60d51c18df.zip
fix bug in context tracking code
My optimisation to avoid recursion into BBs when checking contexts lead to a failure in a case like this: static int warn_conditional(void) { if (condition) return 0; a(); if (condition == 0) return 1; r(); return 0; } because some blocks are called with different contexts and thus need to be checked multiple times. The obvious fix would be to decrease the recursion depth at the end of the BB check function, but that, while correct, leads to extremely long sparse runtimes on somewhat complex functions. Thus, this patch also makes sparse cache which contexts it has checked a block in and avoid the re-checking in that case. Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Diffstat (limited to 'linearize.h')
-rw-r--r--linearize.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/linearize.h b/linearize.h
index 563bf3e..32b1c1a 100644
--- a/linearize.h
+++ b/linearize.h
@@ -219,11 +219,13 @@ enum opcode {
struct basic_block_list;
struct instruction_list;
+struct context_list_list;
struct basic_block {
struct position pos;
unsigned long generation;
- int context;
+ int context_check_recursion;
+ struct context_list_list *checked_contexts;
struct entrypoint *ep;
struct basic_block_list *parents; /* sources */
struct basic_block_list *children; /* destinations */