From: Christopher Li <sparse@chrisli.org>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>,
Michael Stefaniuc <mstefani@mykolab.com>
Subject: Re: [PATCH v3 1/7] fix ptrlist corruption while killing unreachable BBs
Date: Mon, 31 Jul 2017 17:41:07 -0400 [thread overview]
Message-ID: <CANeU7QmGhg0T0ZkGthDoER3QxbV696OZLJ602dc9Tnv0bojFgA@mail.gmail.com> (raw)
In-Reply-To: <20170731203624.58971-2-luc.vanoostenryck@gmail.com>
On Mon, Jul 31, 2017 at 4:36 PM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
>
> Fix this by:
> 1) refuse to emit the "crazy programmer" warning if there
> is a potential dead BB
> 2) move kill_unreachable_bbs() in the main cleanup loop
> which will avoid nested ep->bbs loop.
Great!
>
> Note: this solution is preferable to some others because
> the "crazy programmer" condition happens very rarely.
> It this thus better to delay this check than to call
> kill_unreachable_bbs() preventively.
>
> Note: the reproducer is one with very broken syntax but nothing
> forbid the same situation to happen with a valid program.
>
> Fixes: 51cfbc90a5e1462fcd624a1598ecd985a508a5d6
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
> cse.c | 2 ++
> flow.c | 2 --
> linearize.c | 3 ---
> simplify.c | 9 +++++++++
> validation/crash-ptrlist.c | 23 +++++++++++++++++++++++
> validation/crazy02-not-so.c | 18 ++++++++++++++++++
> 6 files changed, 52 insertions(+), 5 deletions(-)
> create mode 100644 validation/crash-ptrlist.c
>
> diff --git a/cse.c b/cse.c
> index 0d3815c5a..17b3da01a 100644
> --- a/cse.c
> +++ b/cse.c
> @@ -364,6 +364,8 @@ void cleanup_and_cse(struct entrypoint *ep)
> repeat:
> repeat_phase = 0;
> clean_up_insns(ep);
> + if (repeat_phase & REPEAT_CFG_CLEANUP)
> + kill_unreachable_bbs(ep);
> for (i = 0; i < INSN_HASH_SIZE; i++) {
Interesting. So my reading is that, this is similar to the other
alternative patch
we discuss with different that:
1. move up kill_unreachable_bbs(ep) right after clean_up_insns(ep)
> + /*
> + * If some BB have been removed it is possible that this
> + * memop is in fact part of a dead BB. In this case
> + * we must not warn since nothing is wrong.
> + * If not part of a dead BB this will be redone after
> + * the BBs have been cleaned up.
> + */
> + if (repeat_phase & REPEAT_CFG_CLEANUP)
> + return 0;
2. Avoid issue "crazy programmer" if we still have dead code to clean up.
That sound very reasonable and I feel that is better than the previous version
which eager to kill bbs. That is great.
I really appreciate the change.
Chris
next prev parent reply other threads:[~2017-07-31 21:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-31 20:36 [PATCH v3 0/7] fixes for rare issues Luc Van Oostenryck
2017-07-31 20:36 ` [PATCH v3 1/7] fix ptrlist corruption while killing unreachable BBs Luc Van Oostenryck
2017-07-31 21:41 ` Christopher Li [this message]
2017-07-31 22:10 ` Luc Van Oostenryck
2017-07-31 20:36 ` [PATCH v3 2/7] fix infinite simplification loops Luc Van Oostenryck
2017-07-31 20:36 ` [PATCH v3 3/7] fix BB dependencies on phi-nodes Luc Van Oostenryck
2017-07-31 20:36 ` [PATCH v3 4/7] fix crash when ep->active is NULL Luc Van Oostenryck
2017-07-31 20:36 ` [PATCH v3 5/7] fix crash in rewrite_branch() Luc Van Oostenryck
2017-07-31 20:36 ` [PATCH v3 6/7] fix some crashes in add_dominators() Luc Van Oostenryck
2017-07-31 20:36 ` [PATCH v3 7/7] fix crash with sym->bb_target == NULL Luc Van Oostenryck
2017-07-31 21:01 ` [PATCH v3 0/7] fixes for rare issues Christopher Li
2017-07-31 21:54 ` Luc Van Oostenryck
2017-07-31 22:34 ` Luc Van Oostenryck
2017-07-31 22:42 ` Luc Van Oostenryck
2017-08-01 20:46 ` Luc Van Oostenryck
2017-08-01 21:49 ` Christopher Li
2017-08-01 22:10 ` 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=CANeU7QmGhg0T0ZkGthDoER3QxbV696OZLJ602dc9Tnv0bojFgA@mail.gmail.com \
--to=sparse@chrisli.org \
--cc=linux-sparse@vger.kernel.org \
--cc=luc.vanoostenryck@gmail.com \
--cc=mstefani@mykolab.com \
/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).