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 tree-optimization/113372] wrong code with _BitInt() arithmetics at -O1
Date: Tue, 16 Jan 2024 07:21:26 +0000	[thread overview]
Message-ID: <bug-113372-4-wr68py4U29@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113372-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #18 from rguenther at suse dot de <rguenther at suse dot de> ---
On Mon, 15 Jan 2024, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113372
> 
> --- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #15)
> > (In reply to Jakub Jelinek from comment #14)
> > > Created attachment 57085 [details]
> > > gcc14-pr113372.patch
> > > 
> > > The non-propagation workaround which seems to fix^H^H^Hworkaround all those
> > > 4 issues (PR90348 testcase actually doesn't FAIL anymore, but I've verified
> > > the patch results in in and buf no longer being shared) can look like this.
> > 
> > +	  || (INTEGRAL_TYPE_P (TREE_TYPE (use))
> > +	      && TYPE_PRECISION (TREE_TYPE (use)) == POINTER_SIZE)))
> > 
> > ptrofftype_p (TREE_TYPE (use))
> 
> Aren't there targets where pointers are larger than sizetype?
> I thought msp430, but that one uses __int20.

There are also address-spaces with pointer sizes different from
POINTER_SIZE.  I suppose tracking all INTEGRAL_TYPE_P uses and
instead relying on the def to identify a pointer source would work
as well.

> > I think it should be enough to look at gimple_assing_rhs1, that works
> > for single non-invariant &a[i], for conversions and for offsetting of
> > an invariant address (pointer-plus).
> 
> Is the invariant operand guaranteed to go first?  If it is pointer, guess
> POINTER_PLUS_EXPR enforces that, and for sizetype addition guess an operand
> can't be ADDR_EXPR, there would need to be a cast in a separate stmt.  So
> perhaps ok.

Yes, I think that works.

> As for Micha's fears, I can certainly try to dump statistics during
> bootstrap/regtest on how many variables were shared and/or their cumulative
> size without/with the patch and see if it has significant effects on real-world
> code.

Might be interesting to dump the stack size saved due to sharing instead?

Do we really need to handle the PHI nodes btw?  With doing propagation
we could avoid marking certain use sites as mentions, like compares
of the address value.  But of course we'd have to give up for uses
in calls or other things we can't analyze.

  parent reply	other threads:[~2024-01-16  7:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-13  8:53 [Bug tree-optimization/113372] New: " zsojka at seznam dot cz
2024-01-13  9:03 ` [Bug tree-optimization/113372] " pinskia at gcc dot gnu.org
2024-01-15 10:28 ` jakub at gcc dot gnu.org
2024-01-15 10:33 ` jakub at gcc dot gnu.org
2024-01-15 11:25 ` jakub at gcc dot gnu.org
2024-01-15 11:31 ` rguenther at suse dot de
2024-01-15 11:51 ` jakub at gcc dot gnu.org
2024-01-15 12:07 ` jakub at gcc dot gnu.org
2024-01-15 12:19 ` rguenth at gcc dot gnu.org
2024-01-15 12:43 ` jakub at gcc dot gnu.org
2024-01-15 12:55 ` jakub at gcc dot gnu.org
2024-01-15 13:04 ` rguenth at gcc dot gnu.org
2024-01-15 13:35 ` jakub at gcc dot gnu.org
2024-01-15 13:47 ` rguenther at suse dot de
2024-01-15 14:35 ` jakub at gcc dot gnu.org
2024-01-15 14:42 ` rguenth at gcc dot gnu.org
2024-01-15 14:43 ` matz at gcc dot gnu.org
2024-01-15 14:58 ` jakub at gcc dot gnu.org
2024-01-16  7:21 ` rguenther at suse dot de [this message]
2024-01-16 10:51 ` cvs-commit at gcc dot gnu.org
2024-01-16 10:56 ` jakub at gcc dot gnu.org
2024-01-20 17:09 ` pinskia at gcc dot gnu.org
2024-03-02  0:38 ` cvs-commit at gcc dot gnu.org
2024-03-28 11:01 ` jakub 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-113372-4-wr68py4U29@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).