public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/96354] [10/11 Regression] ICE in maybe_canonicalize_mem_ref_addr, at gimple-fold.c:4903 since r10-2271-gd81ab49d0586fca0
Date: Wed, 29 Jul 2020 12:22:56 +0000	[thread overview]
Message-ID: <bug-96354-4-3m6v8HCas2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96354-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96354

--- Comment #16 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 29 Jul 2020, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96354
> 
> --- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> We have indeed:
>   # DEBUG D#2 => MEM[(double *)&<retval>]
> and on the caller side:
>   D.2566[_9] = foo<3, 3> (D.2559, D.2572); [return slot optimization]
> So, that is why to &<retval> &D.2566[_9] is propagated.
> Now, if I add to foo a call to some function template that takes &t as
> argument, this is handled correctly because id->regimplify is set to true and
> the
> qux<C<3> > (&D.2572[_9]);
> call is fixed up by gimple_regimplify_operands.  That function really isn't
> called on debug stmts though (and not prepared to be called for them).
> If I use
> template <int N, int M> C<N> foo (D<N>, C<M>) { C<N> t; double d = 1.25;
> __builtin_memcpy (&t, &d, sizeof (double)); return t; }
> instead so that before that inlining we get
>   MEM <long unsigned int> [(char * {ref-all})&<retval>] = _4;
> then it is indeed again gimple_regimplify_operands that fixes up the
> MEM <long unsigned int> [(char * {ref-all})&D.2569[_9]] = 4608308318706860032;
> into:
>   _21 = &D.2569[_9];
>   MEM <long unsigned int> [(char * {ref-all})_21] = 4608308318706860032;

So we could avoid (some) regimplification if we'd dealt with this
gimplification step during return value setup.  We then only might
not re-propagate things and so

 <retval>.b;

might be forever

 tem_1 = &D.123[j_3];
 MEM[tem_1].b;

instead of

 D.123[j_3].b;

doing the re-gimplification when we replace things from the
decl map might be possible as well of course (and we then
would have "context" and could do special things when in
ADDR_EXPR context).  Not sure how ugly that is.

Not sure how bad the non-propagation above is either and how
often it triggers.

  parent reply	other threads:[~2020-07-29 12:22 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 11:26 [Bug c++/96354] New: [10 regression] ICE in maybe_canonicalize_mem_ref_addr, at gimple-fold.c:4903 tm@dev-zero.ch
2020-07-28 11:41 ` [Bug c++/96354] " marxin at gcc dot gnu.org
2020-07-28 13:21 ` tm@dev-zero.ch
2020-07-28 13:41 ` rguenth at gcc dot gnu.org
2020-07-28 13:43 ` marxin at gcc dot gnu.org
2020-07-28 14:03 ` [Bug c++/96354] [10/11 Regression] ICE in maybe_canonicalize_mem_ref_addr, at gimple-fold.c:4903 since r10-2271-gd81ab49d0586fca0 marxin at gcc dot gnu.org
2020-07-28 14:18 ` marxin at gcc dot gnu.org
2020-07-28 14:20 ` jakub at gcc dot gnu.org
2020-07-28 14:45 ` jakub at gcc dot gnu.org
2020-07-28 16:25 ` rguenther at suse dot de
2020-07-28 16:34 ` jakub at gcc dot gnu.org
2020-07-28 18:03 ` jakub at gcc dot gnu.org
2020-07-29  8:20 ` rguenther at suse dot de
2020-07-29  9:50 ` [Bug debug/96354] " jakub at gcc dot gnu.org
2020-07-29 11:24 ` rguenth at gcc dot gnu.org
2020-07-29 11:44 ` rguenth at gcc dot gnu.org
2020-07-29 11:49 ` jakub at gcc dot gnu.org
2020-07-29 12:22 ` rguenther at suse dot de [this message]
2020-07-29 12:26 ` jakub at gcc dot gnu.org
2020-07-29 12:31 ` rguenther at suse dot de
2020-07-29 12:44 ` jakub at gcc dot gnu.org
2020-07-29 13:00 ` rguenther at suse dot de
2020-08-03 11:34 ` jakub at gcc dot gnu.org
2020-08-03 13:01 ` rguenth at gcc dot gnu.org
2020-08-04  9:32 ` cvs-commit at gcc dot gnu.org
2020-08-04  9:46 ` cvs-commit at gcc dot gnu.org
2020-09-01  8:32 ` rguenth at gcc dot gnu.org

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=bug-96354-4-3m6v8HCas2@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).