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 tree-optimization/114403] [14 regression] LLVM miscompiled with -O3 -march=znver2 -fno-vect-cost-model since r14-6822-g01f4251b8775c8
Date: Fri, 12 Apr 2024 10:12:51 +0000	[thread overview]
Message-ID: <bug-114403-4-HmyckY7vpz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114403-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #23 from Richard Biener <rguenth at gcc dot gnu.org> ---
Maybe easier to understand testcase:

long x[9];
long a[20];
struct { long x; long b[40]; } b;
int __attribute__((noipa))
foo (int n)
{
  int i = 0;
  int k = 0;
  do
    {
      if (x[k++])  // early exit, loop upper bound is 8 because of this
        break;
      a[i] = b.b[2*i]; // the misaligned 2*i access causes peeling for gaps
    }
  while (++i < n);
  return i;
}

int main()
{
  x[8] = 1;
  if (foo (20) != 8)
    __builtin_abort ();
  return 0;
}

with -O3 -msse4.1 -fno-vect-cost-model we return 20 instead of 8.  Adding
-fdisable-tree-cunroll avoids the issue.  The upper bound we set on the
vector loop causes us to force taking the IV exit which continues
with i == (niter - 1) / VF * VF, but 'niter' is 20 here.

  parent reply	other threads:[~2024-04-12 10:12 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 10:44 [Bug tree-optimization/114403] New: [14 regression] sjames at gcc dot gnu.org
2024-03-20 10:44 ` [Bug tree-optimization/114403] [14 regression] LLVM miscompiled with -O3 -march=znver2 -fno-vect-cost-model sjames at gcc dot gnu.org
2024-03-20 10:53 ` sjames at gcc dot gnu.org
2024-03-20 11:49 ` rguenth at gcc dot gnu.org
2024-03-20 17:23 ` [Bug tree-optimization/114403] [14 regression] LLVM miscompiled with -O3 -march=znver2 -fno-vect-cost-model since r14-6822-g01f4251b8775c8 sjames at gcc dot gnu.org
2024-03-20 21:27 ` sjames at gcc dot gnu.org
2024-03-21  3:23 ` sjames at gcc dot gnu.org
2024-03-22  9:47 ` sjames at gcc dot gnu.org
2024-03-22  9:50 ` sjames at gcc dot gnu.org
2024-03-22 10:56 ` sjames at gcc dot gnu.org
2024-03-22 11:26 ` rguenth at gcc dot gnu.org
2024-03-22 12:36 ` law at gcc dot gnu.org
2024-03-22 13:12 ` sjames at gcc dot gnu.org
2024-03-22 13:13 ` sjames at gcc dot gnu.org
2024-03-22 13:13 ` sjames at gcc dot gnu.org
2024-03-22 13:27 ` sjames at gcc dot gnu.org
2024-03-22 13:50 ` rguenth at gcc dot gnu.org
2024-03-22 13:52 ` rguenth at gcc dot gnu.org
2024-03-22 14:27 ` sjames at gcc dot gnu.org
2024-03-22 14:37 ` sjames at gcc dot gnu.org
2024-03-26 10:09 ` rguenth at gcc dot gnu.org
2024-04-02 13:26 ` tnfchris at gcc dot gnu.org
2024-04-02 16:41 ` tnfchris at gcc dot gnu.org
2024-04-11 21:40 ` tnfchris at gcc dot gnu.org
2024-04-11 21:52 ` tnfchris at gcc dot gnu.org
2024-04-12 10:12 ` rguenth at gcc dot gnu.org [this message]
2024-04-12 10:15 ` tnfchris at gcc dot gnu.org
2024-04-12 10:37 ` rguenth at gcc dot gnu.org
2024-04-12 10:40 ` tnfchris at gcc dot gnu.org
2024-04-12 11:27 ` rguenth at gcc dot gnu.org
2024-04-15 11:07 ` cvs-commit at gcc dot gnu.org
2024-04-15 11:08 ` tnfchris at gcc dot gnu.org
2024-04-16 19:56 ` 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-114403-4-HmyckY7vpz@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).