public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rdapp at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/114734] [14] RISC-V rv64gcv_zvl256b miscompile with -flto -O3 -mrvv-vector-bits=zvl
Date: Wed, 24 Apr 2024 14:16:19 +0000	[thread overview]
Message-ID: <bug-114734-4-pBJTz2nPOS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114734-4@http.gcc.gnu.org/bugzilla/>

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

Robin Dapp <rdapp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org,
                   |                            |rsandifo at gcc dot gnu.org

--- Comment #6 from Robin Dapp <rdapp at gcc dot gnu.org> ---
This one is really a bit tricky.

We have the following situation:

loop:
<bb 3>
# vectp_g.178_1078 = PHI <vectp_g.178_1079(3), &gD.2750(2)> 
_911 = &MEM... vectp_g.178_1078
MASK_LEN_LOAD (_911, ...);
vectp_g.178_1079 = vectp_g.178_1078 + 16;
goto loop;

<bb 4>:
MASK_LEN_LOAD (_911, ...);

During expand we basically convert back the _911 to vectp_g.178_1078 (reverting
what we did in ivopts before).  Because _911 camouflages vectp_g.178_1078 until
expand we evaded the conflict checks of outof-ssa that would catch a similar,
non-camouflaged situation like:

# vectp_g.178_1078 = PHI <vectp_g.178_1079(3), &gD.2750(2)> 
MASK_LEN_LOAD (MEM... vectp_g.178_1078, ...);
vectp_g.178_1079 = vectp_g.178_1078 + 16;
goto loop;
MASK_LEN_LOAD (MEM... vectp_g.178_1078, ...);

and would insert a copy of the definition right before the backedge.  The
MASK_LEN_LOAD after the loop would then use that copy.  By using _911 instead
of the original pointer no conflict is detected and we wrongly use the
incremented pointer.  Without the ivopt change for TARGET_MEM_REF

Unless I'm misunderstanding some basic mechanism it's not going to work like
that (and we could also have this situation on aarch64).  What could help is to
enhance trivially_conflicts_p in outof-ssa to catch such TARGET_MEM_REFs here
and handle them similarly to a normal conflict.  I did that locally and it
helps for this particular case but I'd rather not post it in its current hacky
state even if the riscv testsuite looks ok :)  Even if that were the correct
solution I'd doubt it should land in stage 4.

CC'ing Richard Sandiford as he originally introduced the ivopts and expand
handling.

  parent reply	other threads:[~2024-04-24 14:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16  5:14 [Bug target/114734] New: " patrick at rivosinc dot com
2024-04-16  7:47 ` [Bug target/114734] " rdapp at gcc dot gnu.org
2024-04-16  7:51 ` rguenth at gcc dot gnu.org
2024-04-16 11:50 ` rguenth at gcc dot gnu.org
2024-04-16 12:58 ` rdapp at gcc dot gnu.org
2024-04-16 13:14 ` rdapp at gcc dot gnu.org
2024-04-22 15:45 ` rdapp at gcc dot gnu.org
2024-04-24 14:16 ` rdapp at gcc dot gnu.org [this message]
2024-04-25  6:31 ` rguenth at gcc dot gnu.org
2024-04-25  8:15 ` rdapp at gcc dot gnu.org
2024-04-25 13:28 ` rguenth at gcc dot gnu.org
2024-04-25 13:52 ` rdapp at gcc dot gnu.org
2024-04-26 13:45 ` [Bug target/114734] RISC-V rv64gcv_zvl256b miscompile with -flto -O3 -mrvv-vector-bits=zvl since r8-6047-g65dd1346027bb5 rguenth at gcc dot gnu.org
2024-04-26 13:52 ` rguenth at gcc dot gnu.org
2024-04-30  6:46 ` [Bug target/114734] [11/12/13/14/15 regression] " cvs-commit at gcc dot gnu.org
2024-04-30  6:47 ` [Bug target/114734] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-04-30 14:50 ` patrick at rivosinc dot com
2024-05-02 16:22 ` cvs-commit at gcc dot gnu.org
2024-05-03 12:51 ` cvs-commit at gcc dot gnu.org
2024-05-03 12:51 ` cvs-commit at gcc dot gnu.org
2024-05-03 12:52 ` [Bug target/114734] [11/12/13 " rguenth at gcc dot gnu.org
2024-05-06 13:15 ` cvs-commit at gcc dot gnu.org
2024-05-06 13:15 ` cvs-commit at gcc dot gnu.org
2024-05-16  9:56 ` [Bug target/114734] [11/12 " 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-114734-4-pBJTz2nPOS@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).