From: Richard Biener <richard.guenther@gmail.com>
To: Andrew Pinski <apinski@marvell.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix PR 102908: wrongly removing null pointer loads
Date: Mon, 25 Oct 2021 10:36:07 +0200 [thread overview]
Message-ID: <CAFiYyc1nv9F-raARo8W1F_=nB13g3MU-C+o4m-q6nJzUF9nNtQ@mail.gmail.com> (raw)
In-Reply-To: <1635067674-14256-1-git-send-email-apinski@marvell.com>
On Sun, Oct 24, 2021 at 11:28 AM apinski--- via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> From: Andrew Pinski <apinski@marvell.com>
>
> Just like PR 100382, here we have a DCE removing a
> null pointer load which is needed still.
> In this case, execute_fixup_cfg removes a store (correctly)
> and then removes the null load (incorrectly) due to
> not checking stmt_unremovable_because_of_non_call_eh_p.
> This patch adds the check in the similar way as the patch
> to fix PR 100382 did.
OK.
Thanks,
Richard.
> gcc/ChangeLog:
>
> * tree-ssa-dce.c (simple_dce_from_worklist):
> Check stmt_unremovable_because_of_non_call_eh_p also
> before removing the statement.
> ---
> gcc/tree-ssa-dce.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
> index 372e0691ae6..1281e67489c 100644
> --- a/gcc/tree-ssa-dce.c
> +++ b/gcc/tree-ssa-dce.c
> @@ -1828,6 +1828,11 @@ simple_dce_from_worklist (bitmap worklist)
> if (gimple_has_side_effects (t))
> continue;
>
> + /* Don't remove statements that are needed for non-call
> + eh to work. */
> + if (stmt_unremovable_because_of_non_call_eh_p (cfun, t))
> + continue;
> +
> /* Add uses to the worklist. */
> ssa_op_iter iter;
> use_operand_p use_p;
> --
> 2.17.1
>
prev parent reply other threads:[~2021-10-25 8:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-24 9:27 apinski
2021-10-25 8:36 ` Richard Biener [this message]
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='CAFiYyc1nv9F-raARo8W1F_=nB13g3MU-C+o4m-q6nJzUF9nNtQ@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=apinski@marvell.com \
--cc=gcc-patches@gcc.gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).