public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/113372] wrong code with _BitInt() arithmetics at -O1
Date: Mon, 15 Jan 2024 13:35:15 +0000	[thread overview]
Message-ID: <bug-113372-4-QgKGB23QKL@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 #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #11)
> So the key would be to make the object live again after a CLOBBER when such
> address SSA name is used (but before any other explicit mention appears)?
> 
> The current algorithm relies on explitic mentions appearing, one original
> idea was to turn those explicit mentions (or BLOCK starts) into
> start-of-live CLOBBERs, but even that was shown to be not enough.
> 
> But yes, if we want to try to mitigate the problems somewhat without
> doing a full solution then possibly even just looking at SSA defs
> when POINTER_TYPE and the def is an ADDR_EXPR might work (in the
> visit_* callbacks of the walk_stmt_load_store_addr_ops), no propagation
> needed at all (basically just undo CSE virtually here for the simple
> cases).

It couldn't be limited to just POINTER_TYPE, because it mostly is actually
pointer-sized unsigned integer from IVOPTs, but yes, even without full
propagation I think all the testcases I've mentioned could be solved by just
doing the short walks in PHI arguments or other SSA_NAME uses (only PR111422
needs the latter).
For this PR, we'd need to visit for ivtmp.40_3 uses in PHI args the def-stmt:
  ivtmp.40_3 = (unsigned long) &MEM <unsigned long[100]> [(void *)&bitint.6 +
8B];
for PR90348 ivtmp.32_28's def-stmt:
  ivtmp.32_28 = (unsigned long) &in;
for PR110115 ivtmp.27_2's def-stmt:
  ivtmp.27_2 = (unsigned long) &h;
fpr PR111422 _44's def-stmt:
  _44 = &g + _43;
So, if you think it is ok to use just a small hack rather than full propagation
(which could even handle const/pure calls perhaps if they return pointer or
pointer-sized integer), I can implement that too.  Even the full propagation
wouldn't handle everything of course, but could handle more than the small hack
(which would need to be limited to just say 4 def-stmts and wouldn't try to
look through PHIs).

  parent reply	other threads:[~2024-01-15 13:35 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 [this message]
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
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-QgKGB23QKL@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).