Moving the inner optimization loop into the main one help to see the real structure of the optimization logic and facilitate experiments there and any needed changes. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- optimize.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/optimize.c b/optimize.c index 6435d0c87..127a0c42b 100644 --- a/optimize.c +++ b/optimize.c @@ -38,24 +38,6 @@ static void clean_up_insns(struct entrypoint *ep) } END_FOR_EACH_PTR(bb); } -static void cleanup_and_cse(struct entrypoint *ep) -{ - simplify_memops(ep); -repeat: - repeat_phase = 0; - clean_up_insns(ep); - if (repeat_phase & REPEAT_CFG_CLEANUP) - kill_unreachable_bbs(ep); - - cse_eliminate(ep); - - if (repeat_phase & REPEAT_SYMBOL_CLEANUP) - simplify_memops(ep); - - if (repeat_phase & REPEAT_CSE) - goto repeat; -} - void optimize(struct entrypoint *ep) { if (fdump_ir & PASS_LINEARIZE) @@ -83,7 +65,18 @@ repeat: * the rest. */ do { - cleanup_and_cse(ep); + simplify_memops(ep); + do { + repeat_phase = 0; + clean_up_insns(ep); + if (repeat_phase & REPEAT_CFG_CLEANUP) + kill_unreachable_bbs(ep); + + cse_eliminate(ep); + + if (repeat_phase & REPEAT_SYMBOL_CLEANUP) + simplify_memops(ep); + } while (repeat_phase & REPEAT_CSE); pack_basic_blocks(ep); } while (repeat_phase & REPEAT_CSE); -- 2.16.0 -- 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