public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/113255] [11/12/13/14 Regression] wrong code with -O2 -mtune=k8
Date: Wed, 10 Jan 2024 08:57:17 +0000	[thread overview]
Message-ID: <bug-113255-4-xzmsypQayJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113255-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, trying to fix find_base_term isn't enough, init_alias_analysis
find_base_value needs to be adjusted as well.  One "obvious" mistake there
is a missing

diff --git a/gcc/alias.cc b/gcc/alias.cc
index b2ec4806d22..6aeb2167520 100644
--- a/gcc/alias.cc
+++ b/gcc/alias.cc
@@ -1492,6 +1492,13 @@ find_base_value (rtx src)
       {
        rtx temp, src_0 = XEXP (src, 0), src_1 = XEXP (src, 1);

+       /* If both operands of a MINUS are known pointers then the
+          base is not either of them.  */
+       if (GET_CODE (src) == MINUS
+           && REG_P (src_0) && REG_POINTER (src_0)
+           && REG_P (src_1) && REG_POINTER (src_1))
+         return 0;
+
        /* If either operand is a REG that is a known pointer, then it
           is the base.  */
        if (REG_P (src_0) && REG_POINTER (src_0))

but of course that's not conservative - not having REG_POINTER set doesn't
mean it's not a pointer.  But even when we assume REG_POINTER is
correct the minus operands might not be REG_P.

This is really all totally wrong for what it is (pointer analysis on RTL).
On RTL we also lost constraints that arithmetic stays within an object.
It should likely be scrapped completely and re-done, possibly having
SET_DEST_POINTS_TO to be able to put SSA points-to info to SETs
(REG_ATTRs are too coarse, but would be possible as well, losing some of
the flow sensitivity).  Incoming args & frame analysis would need to be
implemented of course.  As said, I'm not sure analyzing RTL will yield
anything good while being conservative - and optimistic points-to is what
leads us to these kind of bugs ...

  parent reply	other threads:[~2024-01-10  8:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-06 23:24 [Bug c/113255] New: " mednafen at sent dot com
2024-01-06 23:53 ` [Bug target/113255] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2024-01-07 12:13 ` jakub at gcc dot gnu.org
2024-01-07 19:48 ` ubizjak at gmail dot com
2024-01-09  7:52 ` rguenth at gcc dot gnu.org
2024-01-09  7:58 ` jakub at gcc dot gnu.org
2024-01-09  8:00 ` ubizjak at gmail dot com
2024-01-09  9:27 ` jakub at gcc dot gnu.org
2024-01-09 10:20 ` rguenth at gcc dot gnu.org
2024-01-09 12:09 ` rguenth at gcc dot gnu.org
2024-01-10  8:57 ` rguenth at gcc dot gnu.org [this message]
2024-01-12  8:48 ` rguenth at gcc dot gnu.org
2024-01-23  7:08 ` cvs-commit at gcc dot gnu.org
2024-01-23  7:10 ` [Bug target/113255] [11/12/13 " rguenth at gcc dot gnu.org
2024-01-23 14:38 ` cvs-commit at gcc dot gnu.org
2024-02-01 12:53 ` rguenth at gcc dot gnu.org
2024-02-01 13:08 ` rguenth at gcc dot gnu.org
2024-02-05  7:35 ` cvs-commit 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-113255-4-xzmsypQayJ@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).