public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gcc-patches:master commit in: 14.0.0/gentoo/
Date: Tue, 13 Feb 2024 11:17:20 +0000 (UTC)	[thread overview]
Message-ID: <1707823023.62e7698eec17981d7d48b5f248a100149fe41514.sam@gentoo> (raw)

commit:     62e7698eec17981d7d48b5f248a100149fe41514
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 13 11:16:25 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Feb 13 11:17:03 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=62e7698e

14.0.0: add 75_all_PR113734_middle_end_update_vector_loop_bounds.patch

Bug: https://gcc.gnu.org/PR113734
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...3734_middle_end_update_vector_loop_bounds.patch | 93 ++++++++++++++++++++++
 14.0.0/gentoo/README.history                       |  4 +
 2 files changed, 97 insertions(+)

diff --git a/14.0.0/gentoo/75_all_PR113734_middle_end_update_vector_loop_bounds.patch b/14.0.0/gentoo/75_all_PR113734_middle_end_update_vector_loop_bounds.patch
new file mode 100644
index 0000000..dcc52df
--- /dev/null
+++ b/14.0.0/gentoo/75_all_PR113734_middle_end_update_vector_loop_bounds.patch
@@ -0,0 +1,93 @@
+https://gcc.gnu.org/PR113734
+
+From 491e57451df47cda88f658601a92d6d006ae09d7 Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Tue, 13 Feb 2024 11:04:38 +0000
+Subject: [PATCH] middle-end: update vector loop upper bounds when early break
+ vect [PR113734]
+
+When doing early break vectorization we should treat the final iteration as
+possibly being partial.  This so that when we calculate the vector loop upper
+bounds we take into account that final iteration could have done some work.
+
+The attached testcase shows that if we don't then cunroll may unroll the loop an
+if the upper bound is wrong we lose a vector iteration.
+
+This is similar to how we adjust the scalar loop bounds for the PEELED case.
+
+gcc/ChangeLog:
+
+	PR tree-optimization/113734
+	* tree-vect-loop.cc (vect_transform_loop): Treat the final iteration of
+	an early break loop as partial.
+
+gcc/testsuite/ChangeLog:
+
+	PR tree-optimization/113734
+	* gcc.dg/vect/vect-early-break_117-pr113734.c: New test.
+---
+ .../vect/vect-early-break_117-pr113734.c      | 37 +++++++++++++++++++
+ gcc/tree-vect-loop.cc                         |  3 +-
+ 2 files changed, 39 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/gcc.dg/vect/vect-early-break_117-pr113734.c
+
+diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_117-pr113734.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_117-pr113734.c
+new file mode 100644
+index 000000000000..36ae09483dfd
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_117-pr113734.c
+@@ -0,0 +1,37 @@
++/* { dg-add-options vect_early_break } */
++/* { dg-require-effective-target vect_early_break_hw } */
++/* { dg-require-effective-target vect_int } */
++/* { dg-additional-options "-O3" } */
++
++/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
++
++#include "tree-vect.h"
++
++#define N 306
++#define NEEDLE 136
++
++int table[N];
++
++__attribute__ ((noipa))
++int foo (int i, unsigned short parse_tables_n)
++{
++  parse_tables_n >>= 9;
++  parse_tables_n += 11;
++  while (i < N && parse_tables_n--)
++    table[i++] = 0;
++
++  return table[NEEDLE];
++}
++
++int main ()
++{
++  check_vect ();
++
++  for (int j = 0; j < N; j++)
++    table[j] = -1;
++
++  if (foo (0, 0xFFFF) != 0)
++    __builtin_abort ();
++
++  return 0;
++}
+diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
+index 04f4b5b6b2fa..367077965fd9 100644
+--- a/gcc/tree-vect-loop.cc
++++ b/gcc/tree-vect-loop.cc
+@@ -12174,7 +12174,8 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call)
+   /* True if the final iteration might not handle a full vector's
+      worth of scalar iterations.  */
+   bool final_iter_may_be_partial
+-    = LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo);
++    = LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo)
++      || LOOP_VINFO_EARLY_BREAKS (loop_vinfo);
+   /* The minimum number of iterations performed by the epilogue.  This
+      is 1 when peeling for gaps because we always need a final scalar
+      iteration.  */
+-- 
+2.43.1
+

diff --git a/14.0.0/gentoo/README.history b/14.0.0/gentoo/README.history
index c175cb7..8cfb3c2 100644
--- a/14.0.0/gentoo/README.history
+++ b/14.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+22	13 Feb 2024
+
+	+ 75_all_PR113734_middle_end_update_vector_loop_bounds.patch
+
 21	12 Feb 2024
 
 	- 75_all_PR113731_fix-ICE-when-moving-statements-to-empty-B.patch


             reply	other threads:[~2024-02-13 11:17 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 11:17 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-07 23:25 [gentoo-commits] proj/gcc-patches:master commit in: 14.0.0/gentoo/ Sam James
2024-03-11 12:43 Sam James
2024-03-07 20:41 Sam James
2024-03-07 20:14 Sam James
2024-03-06 17:47 Sam James
2024-03-03 22:58 Sam James
2024-02-19  0:02 Sam James
2024-02-13 11:17 Sam James
2024-02-12  7:03 Sam James
2024-02-08 11:02 Sam James
2024-02-08 11:02 Sam James
2024-02-07 19:01 Sam James
2024-02-05  0:01 Sam James
2024-02-03  7:52 Sam James
2024-02-03  0:09 Sam James
2024-01-30 15:16 Sam James
2024-01-30 15:16 Sam James
2024-01-28 23:02 Sam James
2024-01-24 13:53 Sam James
2024-01-19  7:45 Sam James
2024-01-17  1:06 Sam James
2024-01-10 12:08 Sam James
2024-01-08  8:10 Sam James
2023-12-31 23:11 Sam James
2023-12-26 18:51 Sam James
2023-12-25 17:18 Sam James
2023-12-25 17:04 Sam James
2023-12-18  0:00 Sam James
2023-12-14 21:23 Sam James
2023-12-10 22:42 Sam James
2023-12-07 18:40 Sam James
2023-12-06 10:52 Sam James
2023-11-20  8:15 Sam James
2023-11-19 11:05 Sam James
2023-11-19 11:04 Sam James
2023-11-14  7:11 Sam James
2023-11-05 22:40 Sam James
2023-10-31 19:56 Sam James
2023-10-27 23:43 Sam James
2023-10-22 23:00 Sam James
2023-10-21 17:42 Sam James
2023-10-16 12:41 Sam James
2023-10-02 13:23 Sam James
2023-06-18 23:02 Sam James
2023-06-15 23:06 Sam James
2023-04-23 23:03 Sam James

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=1707823023.62e7698eec17981d7d48b5f248a100149fe41514.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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