@@ -45,6 +45,12 @@ static void clean_up_insns(struct entrypoint *ep)
} END_FOR_EACH_PTR(bb);
}
+static void cleanup_cfg(struct entrypoint *ep)
+{
+ kill_unreachable_bbs(ep);
+ domtree_build(ep);
+}
+
void optimize(struct entrypoint *ep)
{
if (fdump_ir & PASS_LINEARIZE)
@@ -93,7 +99,7 @@ repeat:
} while (repeat_phase);
pack_basic_blocks(ep);
if (repeat_phase & REPEAT_CFG_CLEANUP)
- kill_unreachable_bbs(ep);
+ cleanup_cfg(ep);
} while (repeat_phase);
vrfy_flow(ep);
@@ -113,7 +119,7 @@ repeat:
if (simplify_flow(ep)) {
clear_liveness(ep);
if (repeat_phase & REPEAT_CFG_CLEANUP)
- kill_unreachable_bbs(ep);
+ cleanup_cfg(ep);
goto repeat;
}
Currently, the dominance tree is build once, just before the SSA conversion. However, changes in the CFG potentially changes the dominance relationships. So, rebuild the dominance tree after changes to the CFG. Note: This doesn't seems to significantly affect the performance (at least when used on the kernel): before after real 4m15.854s real 4m16.95&s user 71m11.390s user 71m29.180s sys 28m45.222s sys 28m46.145s Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- optimize.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)