From: Richard Biener <rguenther@suse.de>
To: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: PR97849: aarch64: ICE (segfault) during GIMPLE pass: ifcvt
Date: Wed, 18 Nov 2020 14:43:09 +0100 (CET) [thread overview]
Message-ID: <nycvar.YFH.7.76.2011181442260.5418@zhemvz.fhfr.qr> (raw)
In-Reply-To: <CAAgBjMkFOXhyFr+KydcbBg8ELFhKS+Ta7_BeL6Y6bgaWJC32DA@mail.gmail.com>
On Wed, 18 Nov 2020, Prathamesh Kulkarni wrote:
> Hi,
> For the following test-case (slightly reduced from PR)
> int a, b, c;
>
> int g() {
> char i = 0;
> for (c = 0; c <= 8; c++)
> --i;
>
> while (b) {
> _Bool f = i <= 0;
> a = (a == 0) ? 0 : f / a;
> }
> }
>
> The compiler segfaults with -O1 -march=armv8.2-a+sve in ifcvt_local_dce.
>
> IIUC, the issue here is that tree-if-conv.c:predicate_rhs_code
> processes the following statement:
> iftmp.2_7 = a_lsm.10_11 != 0 ? iftmp.2_13 : 0;
> and records <iftmp.2_7, iftmp.2_13> mapping.
>
> However RPO VN eliminates iftmp.2_13:
> Removing dead stmt iftmp.2_13 = .COND_DIV (_29, _4, a_lsm.10_11, 0);
>
> and we end up replacing iftmp.2_7 with a dead ssa_name in ifcvt_local_dce:
> FOR_EACH_VEC_ELT (redundant_ssa_names, i, name_pair)
> replace_uses_by (name_pair->first, name_pair->second);
> redundant_ssa_names.release ();
>
> resulting in incorrect IR, and segfault down the line.
>
> To avoid clashing of RPO VN with redunant_ssa_names, the patch simply moves
> ifcvt_local_dce before do_rpo_vn, which avoids the segfault.
> Does that look OK ?
> (Altho I guess, doing DCE after VN is better in principle)
Yes, I'd say just moving
FOR_EACH_VEC_ELT (redundant_ssa_names, i, name_pair)
replace_uses_by (name_pair->first, name_pair->second);
redundant_ssa_names.release ();
before rpo_vn makes more sense, no?
OK with that change.
Thanks,
Richard.
> Thanks,
> Prathamesh
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imend
next prev parent reply other threads:[~2020-11-18 13:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-18 11:34 Prathamesh Kulkarni
2020-11-18 13:43 ` Richard Biener [this message]
2020-11-24 1:32 ` Prathamesh Kulkarni
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=nycvar.YFH.7.76.2011181442260.5418@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=prathamesh.kulkarni@linaro.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).