From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 0/4] tcg: Remove unreachable code
Date: Mon, 26 Nov 2018 15:04:46 -0800 [thread overview]
Message-ID: <20181126230450.672-1-richard.henderson@linaro.org> (raw)
I've been meaning to add a trivial cleanup pass like this for some time.
There have occasionally been instaces within front ends wherein we want
to raise an invalid operand exception (or some such) deep within a set
of subroutines. And without a longjmp (or some such) back to the top
level of the translator loop we must return a dummy value so that we
produce valid tcg code following the exception.
While we still probably have to return a dummy value, we can clean up
the dead code that follows the exception.
In addition, when optimization is able to fold a conditional branch,
the original code sequence:
brcond x,y,$L1
goto_tb
mov pc,foo
exit_tb $1
set_label $L1
goto_tb
mov pc,bar
exit_tb $2
The initial brcond is either folded to br, or removed as a never taken
branch, which leaves one of the two sets of goto_tb ... exit_tb unreachable.
With this we can completely remove the code for the dead branch.
While I do not expect this to have any noticable effect, this dead
code could get in the way of some other changes that I'm planning.
r~
Richard Henderson (4):
tcg: Renumber TCG_CALL_* flags
tcg: Add TCG_CALL_NO_RETURN
tcg: Reference count labels
tcg: Add reachable_code_pass
include/exec/helper-head.h | 13 ++++++
include/exec/helper-tcg.h | 21 ++++++---
tcg/tcg-op.h | 1 +
tcg/tcg.h | 11 +++--
tcg/tcg-op.c | 2 +
tcg/tcg.c | 96 ++++++++++++++++++++++++++++++++++++++
6 files changed, 133 insertions(+), 11 deletions(-)
--
2.17.2
next reply other threads:[~2018-11-26 23:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-26 23:04 Richard Henderson [this message]
2018-11-26 23:04 ` [Qemu-devel] [PATCH 1/4] tcg: Renumber TCG_CALL_* flags Richard Henderson
2018-11-26 23:04 ` [Qemu-devel] [PATCH 2/4] tcg: Add TCG_CALL_NO_RETURN Richard Henderson
2018-11-26 23:04 ` [Qemu-devel] [PATCH 3/4] tcg: Reference count labels Richard Henderson
2018-11-26 23:04 ` [Qemu-devel] [PATCH 4/4] tcg: Add reachable_code_pass Richard Henderson
2018-12-24 22:10 ` Emilio G. Cota
2018-11-28 15:27 ` [Qemu-devel] [PATCH 0/4] tcg: Remove unreachable code no-reply
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=20181126230450.672-1-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=qemu-devel@nongnu.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).