linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 1/2] rebuild dominance tree during CFG cleanup
Date: Tue, 17 Nov 2020 02:10:57 +0100	[thread overview]
Message-ID: <20201117011058.53995-2-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20201117011058.53995-1-luc.vanoostenryck@gmail.com>

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(-)

diff --git a/optimize.c b/optimize.c
index 338714c78e68..c047495f26cf 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;
 	}
 
-- 
2.29.2


  reply	other threads:[~2020-11-17  1:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17  1:10 [PATCH 0/2] simplify CBR-CBR on the same condition Luc Van Oostenryck
2020-11-17  1:10 ` Luc Van Oostenryck [this message]
2020-11-17  1:10 ` [PATCH 2/2] " Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201117011058.53995-2-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).