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/113431] [14 Regression] Wrong code at -O3
Date: Wed, 17 Jan 2024 08:08:43 +0000	[thread overview]
Message-ID: <bug-113431-4-fEsaIyW6oj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113431-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org
           Priority|P3                          |P1

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Looks like a dependence issue - we vectorize it as

  _24 = a[0][1];
  vect_cst__13 = {_24, _24, _24, _24};
  mask__19.9_3 = { 0, 0, 0, 0 } == vect_cst__13;
  vect_patt_31.10_1 = VEC_COND_EXPR <mask__19.9_3, { 1, 1, 1, 1 }, { 0, 0, 0, 0
}>;

  <bb 3> [local count: 29488088]:
  # b.2_66 = PHI <_4(5), 0(2)>
  # ivtmp_45 = PHI <ivtmp_38(5), 2(2)>
  # ivtmp_8 = PHI <ivtmp_14(5), &MEM <int[2][9]> [(void *)&a + 4B](2)>
  # ivtmp_23 = PHI <ivtmp_25(5), 0(2)>
  _18 = a[0][1];
  _19 = _18 == 0;
  _20 = (int) _19;
  MEM <vector(4) int> [(int *)ivtmp_8] = vect_patt_31.10_1;
  MEM <vector(4) int> [(int *)ivtmp_8 + 16B] = vect_patt_31.10_1;
  ivtmp_22 = ivtmp_8 + 36;
  _4 = b.2_66 + 1;
  ivtmp_38 = ivtmp_45 - 1;
  ivtmp_14 = ivtmp_8 + 36;
  ivtmp_25 = ivtmp_23 + 1;
  if (ivtmp_25 < 2)
    goto <bb 5>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 5> [local count: 14744044]:
  goto <bb 3>; [100.00%]

(compute_affine_dependence
  ref_a: a[0][1], stmt_a: _18 = a[0][1];
  ref_b: a[b.2_66][1], stmt_b: a[b.2_66][1] = _20;
(analyze_overlapping_iterations
  (chrec_a = 1)
  (chrec_b = 1)
(analyze_ziv_subscript
)
  (overlap_iterations_a = [0])
  (overlap_iterations_b = [0]))
(analyze_overlapping_iterations
  (chrec_a = 0)
  (chrec_b = {0, +, 1}<nw>_1)
(analyze_siv_subscript
)
  (overlap_iterations_a = [0])
  (overlap_iterations_b = [0]))
(Dependence relation cannot be represented by distance vector.)
)

t.c:8:21: missed:   versioning for alias required: bad dist vector for a[0][1]
and a[b.2_66][1]
consider run-time aliasing test between a[0][1] and a[b.2_66][1]

that looks OK, but we're not emitting such alias test.  We're using SLP
since we can handle non-grouped loads (guess that what it will bisect to).
Then:

t.c:6:16: note:   === vect_prune_runtime_alias_test_list ===
t.c:6:16: note:   no need for alias check between a[0][1] and a[b.2_66][1] when
VF is 1
t.c:6:16: note:   improved number of alias checks from 1 to 0

which is then obviously wrong.

  parent reply	other threads:[~2024-01-17  8:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 21:45 [Bug target/113431] New: [14] RISC-V rv64gcv vector: Runtime mismatch " patrick at rivosinc dot com
2024-01-16 21:46 ` [Bug target/113431] " patrick at rivosinc dot com
2024-01-16 22:37 ` juzhe.zhong at rivai dot ai
2024-01-16 22:57 ` patrick at rivosinc dot com
2024-01-17  1:38 ` juzhe.zhong at rivai dot ai
2024-01-17  1:42 ` patrick at rivosinc dot com
2024-01-17  1:44 ` juzhe.zhong at rivai dot ai
2024-01-17  1:53 ` patrick at rivosinc dot com
2024-01-17  1:56 ` juzhe.zhong at rivai dot ai
2024-01-17  3:33 ` [Bug tree-optimization/113431] [14 Regression] Wrong code " pinskia at gcc dot gnu.org
2024-01-17  8:08 ` rguenth at gcc dot gnu.org [this message]
2024-01-17  8:31 ` juzhe.zhong at rivai dot ai
2024-01-17  8:48 ` rguenth at gcc dot gnu.org
2024-01-17 12:34 ` rguenth at gcc dot gnu.org
2024-01-17 12:59 ` rguenth at gcc dot gnu.org
2024-01-18  7:37 ` cvs-commit at gcc dot gnu.org
2024-01-18  7:39 ` rguenth at gcc dot gnu.org
2024-01-19  8:55 ` ro at gcc dot gnu.org
2024-01-19  8:56 ` ro at gcc dot gnu.org
2024-02-28 14:55 ` ro at gcc dot gnu.org
2024-03-15 14:06 ` jakub at gcc dot gnu.org
2024-03-15 15:42 ` rguenth at gcc dot gnu.org
2024-03-15 15:52 ` cvs-commit at gcc dot gnu.org
2024-03-15 15:53 ` jakub at gcc dot gnu.org
2024-03-19  9:44 ` ro at CeBiTec dot Uni-Bielefeld.DE

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-113431-4-fEsaIyW6oj@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).