diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-18 12:59:03 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-24 10:49:15 +0100 |
| commit | a27bfb381d907ce24163394d01ff2d979404000f (patch) | |
| tree | d5e891d3db0c662b2ad8dfe40e7224c5fa9c08fd | |
| parent | 1cd676703c37472ee533aaa28090e19bbb83bec0 (diff) | |
| download | sparse-dev-a27bfb381d907ce24163394d01ff2d979404000f.tar.gz | |
move the inner optimization loop into the main loop
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@gmail.com>
| -rw-r--r-- | optimize.c | 31 |
1 files changed, 12 insertions, 19 deletions
@@ -40,24 +40,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) @@ -85,7 +67,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); |
