There are several places where it can be usefull to remove dead stores but the existing function for this is local to flow.c & doesn't have an interface easy to use. Change this make a clean interface for this functionality. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- flow.c | 13 +++++++++++++ flow.h | 1 + 2 files changed, 14 insertions(+) diff --git a/flow.c b/flow.c index 0dab7ff2d..cc6158723 100644 --- a/flow.c +++ b/flow.c @@ -770,6 +770,19 @@ void simplify_symbol_usage(struct entrypoint *ep) } END_FOR_EACH_PTR(pseudo); } +void kill_dead_stores(struct entrypoint *ep, pseudo_t addr, int local) +{ + unsigned long generation; + struct basic_block *bb; + + generation = ++bb_generation; + FOR_EACH_PTR(ep->bbs, bb) { + if (bb->children) + continue; + kill_dead_stores_bb(addr, generation, bb, local); + } END_FOR_EACH_PTR(bb); +} + static void mark_bb_reachable(struct basic_block *bb, unsigned long generation) { struct basic_block *child; diff --git a/flow.h b/flow.h index 14cc144cc..c8e12cf0f 100644 --- a/flow.h +++ b/flow.h @@ -14,6 +14,7 @@ struct instruction; extern int simplify_flow(struct entrypoint *ep); +extern void kill_dead_stores(struct entrypoint *ep, pseudo_t addr, int local); extern void simplify_symbol_usage(struct entrypoint *ep); extern void simplify_memops(struct entrypoint *ep); extern void pack_basic_blocks(struct entrypoint *ep); -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html