commit:     69939518b0ee672d5ea016d34ea753d1e2044279
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 24 01:15:12 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jan 24 01:15:12 2026 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=69939518

16.0.0: update vect patch

Signed-off-by: Sam James <sam <AT> gentoo.org>

 16.0.0/gentoo/88_all_PR123657.patch | 83 +++++++++++--------------------------
 1 file changed, 25 insertions(+), 58 deletions(-)

diff --git a/16.0.0/gentoo/88_all_PR123657.patch 
b/16.0.0/gentoo/88_all_PR123657.patch
index 1f0364b..99a3a5a 100644
--- a/16.0.0/gentoo/88_all_PR123657.patch
+++ b/16.0.0/gentoo/88_all_PR123657.patch
@@ -1,9 +1,13 @@
-From 2b3586868aff7d40fb411728367f631c246896d1 Mon Sep 17 00:00:00 2001
-Message-ID: 
<2b3586868aff7d40fb411728367f631c246896d1.1769029705.git....@gentoo.org>
-From: Victor Do Nascimento <[email protected]>
-Date: Wed, 21 Jan 2026 14:10:13 +0000
-Subject: [PATCH] vect: Fix outer loop vectorization for nested uncounted loops
- [PR123657]
+New in this version:
+
+Rather than treating `scev_not_known' as an unexpected value in
+`expr_invariant_in_loop_p' and have the function crash, handle the
+value gracefully by adding check for
+`!automatically_generated_chrec_p (expr)'.
+
+Regtested on AArch64 and x86_64, no regressions found.
+
+---------
 
 Given the inability of `expr_invariant_in_loop_p (loop, expr)' to
 handle the `scev_not_known' node as the expression, an unknown loop
@@ -13,31 +17,28 @@ suitable for vectorization.  This introduces the necessary 
unknown
 loop iteration count check to ensure correct handling of counted loops
 with an embedded uncounted loop.
 
-Bootstrapped on AArch64 and x86_64, no regressions.
-
-gcc/ChangeLog:
+2026-01-22  Victor Do Nascimento  <[email protected]>
 
        PR tree-optimization/123657
        * tree-vect-loop.cc (vect_analyze_loop_form): Add
        chrec_dont_know check.
-       * tree-ssa-loop-ivopts.cc (expr_invariant_in_loop_p):
-       likewise.
 
-gcc/testsuite/ChangeLog:
+       * gcc.dg/vect/vect-uncounted-run_4.c (main): New.
 
-* gcc.dg/vect/vect-uncounted-run_4.c (main): New.
----
- .../gcc.dg/vect/vect-uncounted-run_4.c          | 17 +++++++++++++++++
- gcc/tree-ssa-loop-ivopts.cc                     |  4 ++++
- gcc/tree-vect-loop.cc                           |  3 ++-
- 3 files changed, 23 insertions(+), 1 deletion(-)
- create mode 100644 gcc/testsuite/gcc.dg/vect/vect-uncounted-run_4.c
+--- gcc/tree-vect-loop.cc.jj
++++ gcc/tree-vect-loop.cc
+@@ -1555,7 +1555,8 @@ vect_analyze_loop_form (class loop *loop, gimple 
*loop_vectorized_call,
+       return opt_result::failure_at (vect_location,
+                                      "not vectorized: Bad inner loop.\n");
 
-diff --git a/gcc/testsuite/gcc.dg/vect/vect-uncounted-run_4.c 
b/gcc/testsuite/gcc.dg/vect/vect-uncounted-run_4.c
-new file mode 100644
-index 000000000000..f731daf42d95
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/vect/vect-uncounted-run_4.c
+-      if (!expr_invariant_in_loop_p (loop, inner.number_of_iterations))
++      if (inner.number_of_iterations == chrec_dont_know
++        || !expr_invariant_in_loop_p (loop, inner.number_of_iterations))
+       return opt_result::failure_at (vect_location,
+                                      "not vectorized: inner-loop count not"
+                                      " invariant.\n");
+--- gcc/testsuite/gcc.dg/vect/vect-uncounted-run_4.c.jj
++++ gcc/testsuite/gcc.dg/vect/vect-uncounted-run_4.c
 @@ -0,0 +1,17 @@
 +/* Ensure we don't vectorize outer loops when the inner loop is uncounted.  */
 +/* { dg-add-options vect_early_break } */
@@ -56,37 +57,3 @@ index 000000000000..f731daf42d95
 +}
 +
 +/* { dg-final { scan-tree-dump "missed:   not vectorized: inner-loop count 
not invariant." "vect" } } */
-diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc
-index 6ecf5bef7b4f..62df570003d3 100644
---- a/gcc/tree-ssa-loop-ivopts.cc
-+++ b/gcc/tree-ssa-loop-ivopts.cc
-@@ -1825,6 +1825,10 @@ expr_invariant_in_loop_p (class loop *loop, tree expr)
- 
-   gcc_assert (loop_depth (loop) > 0);
- 
-+  /* CHREC_DONT_KNOW treated as invariant and thus, if not checked,
-+     misleadingly returns TRUE.  */
-+  gcc_assert (expr != chrec_dont_know);
-+
-   if (is_gimple_min_invariant (expr))
-     return true;
- 
-diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
-index c8b9c6268c84..0ce1a85682b7 100644
---- a/gcc/tree-vect-loop.cc
-+++ b/gcc/tree-vect-loop.cc
-@@ -1556,7 +1556,8 @@ vect_analyze_loop_form (class loop *loop, gimple 
*loop_vectorized_call,
-       return opt_result::failure_at (vect_location,
-                                      "not vectorized: Bad inner loop.\n");
- 
--      if (!expr_invariant_in_loop_p (loop, inner.number_of_iterations))
-+      if (inner.number_of_iterations ==  chrec_dont_know
-+        || !expr_invariant_in_loop_p (loop, inner.number_of_iterations))
-       return opt_result::failure_at (vect_location,
-                                      "not vectorized: inner-loop count not"
-                                      " invariant.\n");
-
-base-commit: 59b9ec2d24e60a49d84f874dfe1e947ad1f8ff22
--- 
-2.52.0
-

Reply via email to