aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-11-10 04:04:33 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-11-17 18:04:58 +0100
commit35b1a31ca12eba4c404f4616f768d75ea640302f (patch)
treee6364def411cbf8aa009e9b2e5d912c0021f8383
parent28677f8ac6efd939b2bd306a2b1af0f95ef44136 (diff)
downloadsparse-35b1a31ca12eba4c404f4616f768d75ea640302f.tar.gz
rebuild dominance tree during CFG cleanup
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>
-rw-r--r--optimize.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/optimize.c b/optimize.c
index 338714c7..c047495f 100644
--- a/optimize.c
+++ b/optimize.c
@@ -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;
}