diff -Nrcpad gcc-13-20251030/LAST_UPDATED gcc-13-20251106/LAST_UPDATED
*** gcc-13-20251030/LAST_UPDATED	Thu Oct 30 22:34:11 2025
--- gcc-13-20251106/LAST_UPDATED	Thu Nov  6 22:33:56 2025
***************
*** 1 ****
! Obtained from git: releases/gcc-13 revision 8e583d8d0be40a58e6acfa3d62e5839b07bea163
--- 1 ----
! Obtained from git: releases/gcc-13 revision 1aa2fc950597e367101d4530789473f68c252254
diff -Nrcpad gcc-13-20251030/MD5SUMS gcc-13-20251106/MD5SUMS
*** gcc-13-20251030/MD5SUMS	Thu Oct 30 22:34:15 2025
--- gcc-13-20251106/MD5SUMS	Thu Nov  6 22:34:04 2025
***************
*** 1,5 ****
  # This file contains the MD5 checksums of the files in the
! # gcc-13-20251030.tar.xz tarball.
  #
  # Besides verifying that all files in the tarball were correctly expanded,
  # it also can be used to determine if any files have changed since the
--- 1,5 ----
  # This file contains the MD5 checksums of the files in the
! # gcc-13-20251106.tar.xz tarball.
  #
  # Besides verifying that all files in the tarball were correctly expanded,
  # it also can be used to determine if any files have changed since the
*************** d32239bcb673463ab874e80d47fae504  COPYIN
*** 21,27 ****
  fd4ecdf5d672efe2b0e409aca9cf9446  ChangeLog.jit
  09538b708302f1735f6fa05b622ecf5e  ChangeLog.tree-ssa
  24ab760126489e69436a43185dc3d202  INSTALL/README
! f79a34abfc323ec8b52787fcb88f7a87  LAST_UPDATED
  81b3330d422f3ce1ef8b720dfae35068  MAINTAINERS
  2b61ddbd876fa839639a7ca551773426  Makefile.def
  5d2d6a74f897f8158d37f5f2ec6877ce  Makefile.in
--- 21,27 ----
  fd4ecdf5d672efe2b0e409aca9cf9446  ChangeLog.jit
  09538b708302f1735f6fa05b622ecf5e  ChangeLog.tree-ssa
  24ab760126489e69436a43185dc3d202  INSTALL/README
! 702ca9b3dc10033d1e7ba52407f9da17  LAST_UPDATED
  81b3330d422f3ce1ef8b720dfae35068  MAINTAINERS
  2b61ddbd876fa839639a7ca551773426  Makefile.def
  5d2d6a74f897f8158d37f5f2ec6877ce  Makefile.in
*************** a22e70b3f29292d0e628450f4bb11e62  fixinc
*** 475,481 ****
  a916467b91076e631dd8edb7424769c7  gcc/COPYING.LIB
  d32239bcb673463ab874e80d47fae504  gcc/COPYING3
  6a6a8e020838b23406c81b19c1d46df6  gcc/COPYING3.LIB
! dbcb5aa857b3655ff935ceea992ad9e1  gcc/ChangeLog
  a3b63c675afa7a655cc2bfa8a907af79  gcc/ChangeLog-1997
  d9a88529352a010253c2e8fb1ed6023b  gcc/ChangeLog-1998
  240f08f81cb4699e8b49347db38233db  gcc/ChangeLog-1999
--- 475,481 ----
  a916467b91076e631dd8edb7424769c7  gcc/COPYING.LIB
  d32239bcb673463ab874e80d47fae504  gcc/COPYING3
  6a6a8e020838b23406c81b19c1d46df6  gcc/COPYING3.LIB
! c4d0dc325fe4df559ac4f557fef4d599  gcc/ChangeLog
  a3b63c675afa7a655cc2bfa8a907af79  gcc/ChangeLog-1997
  d9a88529352a010253c2e8fb1ed6023b  gcc/ChangeLog-1998
  240f08f81cb4699e8b49347db38233db  gcc/ChangeLog-1999
*************** fb3fadb88e1d2b3b640cfaaa5ff11780  gcc/Ch
*** 510,516 ****
  3eb07e0b2e542409bf73d359f7f65609  gcc/ChangeLog.ptr
  e13638e26743ba41e6011b76cc00d9a9  gcc/ChangeLog.tree-ssa
  739ab47f6425bcea1d05e4fc0542de54  gcc/ChangeLog.tuples
! 6d09a293044f6ae47a068da72986dfad  gcc/DATESTAMP
  d41d8cd98f00b204e9800998ecf8427e  gcc/DEV-PHASE
  eb92e1ff5e982ca07e173e0eb286d243  gcc/FSFChangeLog
  30e1e33411566388b3164558482dc5e6  gcc/FSFChangeLog.10
--- 510,516 ----
  3eb07e0b2e542409bf73d359f7f65609  gcc/ChangeLog.ptr
  e13638e26743ba41e6011b76cc00d9a9  gcc/ChangeLog.tree-ssa
  739ab47f6425bcea1d05e4fc0542de54  gcc/ChangeLog.tuples
! 50cc4a1ed873cd1cb8e25b059b2925e2  gcc/DATESTAMP
  d41d8cd98f00b204e9800998ecf8427e  gcc/DEV-PHASE
  eb92e1ff5e982ca07e173e0eb286d243  gcc/FSFChangeLog
  30e1e33411566388b3164558482dc5e6  gcc/FSFChangeLog.10
*************** d5ca1928fb0eef4a39e419faa25782b4  gcc/co
*** 3549,3555 ****
  82e55abb13cdee932b88cb4c074f76fe  gcc/config/avr/builtins.def
  f0880103f5af621d5051b6b0ef710ba1  gcc/config/avr/constraints.md
  751bd406a3dcc3e4cc452b962e925114  gcc/config/avr/driver-avr.cc
! 828f146c096d2950c6ab263bc3818e13  gcc/config/avr/elf.h
  7dea2902f1765bf0a4a6483fadb36c32  gcc/config/avr/gen-avr-mmcu-specs.cc
  bcef8a3e0aed8ec9bca46e7c98959588  gcc/config/avr/gen-avr-mmcu-texi.cc
  b66a49b68d591a6c0b7af5fc6a368c25  gcc/config/avr/genmultilib.awk
--- 3549,3555 ----
  82e55abb13cdee932b88cb4c074f76fe  gcc/config/avr/builtins.def
  f0880103f5af621d5051b6b0ef710ba1  gcc/config/avr/constraints.md
  751bd406a3dcc3e4cc452b962e925114  gcc/config/avr/driver-avr.cc
! e385867b49fdaa675228e06994b0aba3  gcc/config/avr/elf.h
  7dea2902f1765bf0a4a6483fadb36c32  gcc/config/avr/gen-avr-mmcu-specs.cc
  bcef8a3e0aed8ec9bca46e7c98959588  gcc/config/avr/gen-avr-mmcu-texi.cc
  b66a49b68d591a6c0b7af5fc6a368c25  gcc/config/avr/genmultilib.awk
*************** b829ed0032c899e107be2db349c913f3  gcc/ta
*** 7637,7643 ****
  811da275a2b9d3186a6decf96c01b0ed  gcc/targhooks.cc
  edb193a32070c4a7626fb75382def9b9  gcc/targhooks.h
  f39fcaa8197187283ccfed40107b426d  gcc/testsuite/.gitattributes
! 23a6e141bf9e11a1a36a610055676f18  gcc/testsuite/ChangeLog
  862f04afbd87da2cc6bc432c3f28430f  gcc/testsuite/ChangeLog-1993-2007
  029a5d8dacd25eb5d4711452ac448e5b  gcc/testsuite/ChangeLog-2008
  13ac28c41d51b66b4ec40dba6bd50f39  gcc/testsuite/ChangeLog-2009
--- 7637,7643 ----
  811da275a2b9d3186a6decf96c01b0ed  gcc/targhooks.cc
  edb193a32070c4a7626fb75382def9b9  gcc/targhooks.h
  f39fcaa8197187283ccfed40107b426d  gcc/testsuite/.gitattributes
! bff3a4cd070480b1893e35de7cac8df7  gcc/testsuite/ChangeLog
  862f04afbd87da2cc6bc432c3f28430f  gcc/testsuite/ChangeLog-1993-2007
  029a5d8dacd25eb5d4711452ac448e5b  gcc/testsuite/ChangeLog-2008
  13ac28c41d51b66b4ec40dba6bd50f39  gcc/testsuite/ChangeLog-2009
*************** ef666186552a9562e70783bbdf98ac33  gcc/te
*** 27521,27526 ****
--- 27521,27527 ----
  f298eddbaaad3dfdc15f6cf9683ff08a  gcc/testsuite/g++.dg/torture/pr11911.C
  9df51f0b5a7e716286f2e97dfd28d477  gcc/testsuite/g++.dg/torture/pr119610.C
  9cede7e8b587157ccdf0f9f6667d6cc8  gcc/testsuite/g++.dg/torture/pr119778.C
+ 75b55c517ba9c0f47c83851f084cb294  gcc/testsuite/g++.dg/torture/pr121870.C
  161154ed9f6193a2a7da119e068c3f3f  gcc/testsuite/g++.dg/torture/pr27218.C
  a84e9fff95df4801f8e582fbc33303b8  gcc/testsuite/g++.dg/torture/pr30252.C
  e980bf95890544d46879b89f7aa98df6  gcc/testsuite/g++.dg/torture/pr30567.C
*************** fbc66d37323062d4dfeea9f5f179a29e  gcc/te
*** 47822,47827 ****
--- 47823,47829 ----
  673535a31d0d70358a6475962b4d71c2  gcc/testsuite/gcc.dg/torture/pr118476-1.c
  d29f5dbd5ce72ebe101793547b043347  gcc/testsuite/gcc.dg/torture/pr118717.c
  4f00237a70e232a883a71b2c8d7c8f95  gcc/testsuite/gcc.dg/torture/pr118922-1.c
+ e23df6b1422011499b9a500d2bf25add  gcc/testsuite/gcc.dg/torture/pr120944.c
  ded4330fd1cd52783bd9b1761db038ef  gcc/testsuite/gcc.dg/torture/pr16104-1.c
  fc265ee05da2f29f0e92804661cd1f28  gcc/testsuite/gcc.dg/torture/pr17526.c
  01c583edb41b632b835aa892b9c1cb14  gcc/testsuite/gcc.dg/torture/pr17933-1.c
*************** d26c1450e737c9198e3e413deb96e2b3  gcc/te
*** 52025,52030 ****
--- 52027,52034 ----
  b8e70a728432436afa060e498411cc94  gcc/testsuite/gcc.dg/vect/pr119145.c
  8312a9b4f3649f0390632c660109eb1d  gcc/testsuite/gcc.dg/vect/pr119399.c
  f5749a6330ea4377b859350a23760b4a  gcc/testsuite/gcc.dg/vect/pr119534.c
+ 7df91aea22a8a2dc08bd0d355fa30fae  gcc/testsuite/gcc.dg/vect/pr120817.c
+ 3ccd618a730abdb13ec305c26f14ac22  gcc/testsuite/gcc.dg/vect/pr121059.c
  42d48d2ecd5682545b12ac42f879a831  gcc/testsuite/gcc.dg/vect/pr16105.c
  231c99dba9475fe09525bbf6f4374124  gcc/testsuite/gcc.dg/vect/pr18308.c
  3aed50f38aa86c4915d6e4b3cef91287  gcc/testsuite/gcc.dg/vect/pr18400.c
*************** f77bcd6abf3d7fc181b5c9099b8107e9  gcc/te
*** 53151,53156 ****
--- 53155,53162 ----
  57fce33d05ece46874b1533bb515f641  gcc/testsuite/gcc.dg/vect/vect-recurr-4.c
  4fd234c6d904b08de1c1ef5da8a85989  gcc/testsuite/gcc.dg/vect/vect-recurr-5.c
  341e8cf83af90ee08e2f0e11eabd1b72  gcc/testsuite/gcc.dg/vect/vect-recurr-6.c
+ 7871d15555bf4ec0abcd6a88f3433086  gcc/testsuite/gcc.dg/vect/vect-recurr-pr121256-2.c
+ 39b82075f86d610ada0f9574ce45d00a  gcc/testsuite/gcc.dg/vect/vect-recurr-pr121256.c
  14379418c35bd92a759c557ae5c861c6  gcc/testsuite/gcc.dg/vect/vect-reduc-1.c
  22a0d53785f7d6c47cd23f6847097e73  gcc/testsuite/gcc.dg/vect/vect-reduc-10.c
  5e2267c9823c709c9186c2bae29c4b9e  gcc/testsuite/gcc.dg/vect/vect-reduc-11.c
*************** da67de91badb3e7882b0f0f56a67670e  gcc/tr
*** 100496,100502 ****
  e36c0da1e5dc257d4ccff9c24043d7fc  gcc/tree-ssa-dce.h
  35f365067a15b900bdc007c8c4366fd1  gcc/tree-ssa-dom.cc
  aba207ac671bbe2380e556429ad21a00  gcc/tree-ssa-dom.h
! 96193370d3840ed2faa499783b5b1028  gcc/tree-ssa-dse.cc
  9fe4418350cac32811c9ed2ed8de371f  gcc/tree-ssa-dse.h
  8d97cf47138ffd7cd6f4c316e206b8f2  gcc/tree-ssa-forwprop.cc
  567c30a8d9160fdcd286536c8e4a553e  gcc/tree-ssa-ifcombine.cc
--- 100502,100508 ----
  e36c0da1e5dc257d4ccff9c24043d7fc  gcc/tree-ssa-dce.h
  35f365067a15b900bdc007c8c4366fd1  gcc/tree-ssa-dom.cc
  aba207ac671bbe2380e556429ad21a00  gcc/tree-ssa-dom.h
! 06b408425e068ded81092e5bcc7d6022  gcc/tree-ssa-dse.cc
  9fe4418350cac32811c9ed2ed8de371f  gcc/tree-ssa-dse.h
  8d97cf47138ffd7cd6f4c316e206b8f2  gcc/tree-ssa-forwprop.cc
  567c30a8d9160fdcd286536c8e4a553e  gcc/tree-ssa-ifcombine.cc
*************** e9484a6f5b1f9056c6681cedce910ed4  gcc/tr
*** 100523,100533 ****
  e78eec419e994fc2d9ed7161400c6439  gcc/tree-ssa-phiopt.cc
  731542d52a45ac5f609554aee9faf6dd  gcc/tree-ssa-phiprop.cc
  ef15621f3fcf286ff9b897cc3ef0d498  gcc/tree-ssa-pre.cc
! 92e37073a834f5e59681947910d76467  gcc/tree-ssa-propagate.cc
  658e45ca3c1c387fbd4e8bf835de1acd  gcc/tree-ssa-propagate.h
  58c0ef78644b94b752f3d6d91823c3f9  gcc/tree-ssa-reassoc.cc
  3d6728ab6aa97921854f86b5d2116c3d  gcc/tree-ssa-reassoc.h
! f242dd217d813b8a7e504a36b4aa24d3  gcc/tree-ssa-sccvn.cc
  1c663c39e61b7e64cbea685db2598475  gcc/tree-ssa-sccvn.h
  0dd72fccd9280ac160f5ac770517ee10  gcc/tree-ssa-scopedtables.cc
  bdda02f8f5872266cc26122c45c7d248  gcc/tree-ssa-scopedtables.h
--- 100529,100539 ----
  e78eec419e994fc2d9ed7161400c6439  gcc/tree-ssa-phiopt.cc
  731542d52a45ac5f609554aee9faf6dd  gcc/tree-ssa-phiprop.cc
  ef15621f3fcf286ff9b897cc3ef0d498  gcc/tree-ssa-pre.cc
! fa89601dd394c5e02d327c2c2aebf80e  gcc/tree-ssa-propagate.cc
  658e45ca3c1c387fbd4e8bf835de1acd  gcc/tree-ssa-propagate.h
  58c0ef78644b94b752f3d6d91823c3f9  gcc/tree-ssa-reassoc.cc
  3d6728ab6aa97921854f86b5d2116c3d  gcc/tree-ssa-reassoc.h
! ddc1ad96c9216dbdf654ab58e74766a1  gcc/tree-ssa-sccvn.cc
  1c663c39e61b7e64cbea685db2598475  gcc/tree-ssa-sccvn.h
  0dd72fccd9280ac160f5ac770517ee10  gcc/tree-ssa-scopedtables.cc
  bdda02f8f5872266cc26122c45c7d248  gcc/tree-ssa-scopedtables.h
*************** a4918516d4e0d24a0f05be8cdde5d93f  gcc/tr
*** 100561,100571 ****
  d255c49e1e03485afa4f96cbc7ef5d94  gcc/tree-vect-data-refs.cc
  8d1574c041db981b77499997880f38ff  gcc/tree-vect-generic.cc
  c45157ab0aed55ef9c76715a91e9ec64  gcc/tree-vect-loop-manip.cc
! a3f570d0bae1f5cb941213a48c4e8187  gcc/tree-vect-loop.cc
  fc473067a8cba47493488fd0e39e82e1  gcc/tree-vect-patterns.cc
  b2d8890f59e3b9eaa4fce183bf5f75be  gcc/tree-vect-slp-patterns.cc
  ae5fc3590da86a81b77b9bbbda17c40c  gcc/tree-vect-slp.cc
! 2578b9def1e89bc98e186ae47cdbfc3d  gcc/tree-vect-stmts.cc
  9ed16219bf6ab97b79539fb1bca89485  gcc/tree-vector-builder.cc
  672861a6f3b4ede253a47c708e10856d  gcc/tree-vector-builder.h
  ca7a666858d4e46dfb08e1e6932bb5f4  gcc/tree-vectorizer.cc
--- 100567,100577 ----
  d255c49e1e03485afa4f96cbc7ef5d94  gcc/tree-vect-data-refs.cc
  8d1574c041db981b77499997880f38ff  gcc/tree-vect-generic.cc
  c45157ab0aed55ef9c76715a91e9ec64  gcc/tree-vect-loop-manip.cc
! df6079d25ce36b8c45d4d6e500c82ee8  gcc/tree-vect-loop.cc
  fc473067a8cba47493488fd0e39e82e1  gcc/tree-vect-patterns.cc
  b2d8890f59e3b9eaa4fce183bf5f75be  gcc/tree-vect-slp-patterns.cc
  ae5fc3590da86a81b77b9bbbda17c40c  gcc/tree-vect-slp.cc
! f29cc0aa032e863fc48da6b0d0c78fc5  gcc/tree-vect-stmts.cc
  9ed16219bf6ab97b79539fb1bca89485  gcc/tree-vector-builder.cc
  672861a6f3b4ede253a47c708e10856d  gcc/tree-vector-builder.h
  ca7a666858d4e46dfb08e1e6932bb5f4  gcc/tree-vectorizer.cc
diff -Nrcpad gcc-13-20251030/gcc/ChangeLog gcc-13-20251106/gcc/ChangeLog
*** gcc-13-20251030/gcc/ChangeLog	Thu Oct 30 22:32:13 2025
--- gcc-13-20251106/gcc/ChangeLog	Thu Nov  6 22:32:19 2025
***************
*** 1,3 ****
--- 1,51 ----
+ 2025-10-31  Richard Biener  <rguenther@suse.de>
+ 
+ 	Backported from master:
+ 	2025-09-11  Richard Biener  <rguenther@suse.de>
+ 
+ 	PR tree-optimization/121870
+ 	* tree-ssa-propagate.cc
+ 	(substitute_and_fold_engine::substitute_and_fold): Skip
+ 	removed stmts from noreturn fixup.
+ 
+ 2025-10-31  Richard Biener  <rguenther@suse.de>
+ 
+ 	Backported from master:
+ 	2025-10-14  Richard Biener  <rguenther@suse.de>
+ 
+ 	PR tree-optimization/121256
+ 	* tree-vect-loop.cc (vectorizable_recurr): Build a correct
+ 	initialization vector for SLP_TREE_LANES > 1.
+ 
+ 2025-10-31  Richard Biener  <rguenther@suse.de>
+ 
+ 	Backported from master:
+ 	2025-10-14  Richard Biener  <rguenther@suse.de>
+ 		    Richard Sandiford   <richard.sandiford@arm.com>
+ 
+ 	PR tree-optimization/121059
+ 	* tree-vect-stmts.cc (vectorizable_operation): Query
+ 	scalar_cond_masked_set with the correct number of masks.
+ 
+ 2025-10-31  Richard Biener  <rguenther@suse.de>
+ 
+ 	Backported from master:
+ 	2025-07-04  Richard Biener  <rguenther@suse.de>
+ 
+ 	PR tree-optimization/120944
+ 	* tree-ssa-sccvn.cc (vn_reference_lookup_3): Gate optimizations
+ 	invalid when volatile is involved.
+ 
+ 2025-10-31  Richard Biener  <rguenther@suse.de>
+ 
+ 	Backported from master:
+ 	2025-07-07  Richard Biener  <rguenther@suse.de>
+ 
+ 	PR tree-optimization/120817
+ 	* tree-ssa-dse.cc (initialize_ao_ref_for_dse): Use
+ 	ao_ref_init_from_ptr_and_range with unknown size for
+ 	.MASK_STORE and .MASK_LEN_STORE.
+ 
  2025-10-26  LIU Hao  <lh_mouse@126.com>
  
  	Backported from master:
diff -Nrcpad gcc-13-20251030/gcc/DATESTAMP gcc-13-20251106/gcc/DATESTAMP
*** gcc-13-20251030/gcc/DATESTAMP	Thu Oct 30 22:32:13 2025
--- gcc-13-20251106/gcc/DATESTAMP	Thu Nov  6 22:32:19 2025
***************
*** 1 ****
! 20251030
--- 1 ----
! 20251106
diff -Nrcpad gcc-13-20251030/gcc/config/avr/elf.h gcc-13-20251106/gcc/config/avr/elf.h
*** gcc-13-20251030/gcc/config/avr/elf.h	Thu Oct 30 22:32:14 2025
--- gcc-13-20251106/gcc/config/avr/elf.h	Thu Nov  6 22:32:20 2025
***************
*** 17,22 ****
--- 17,35 ----
     along with GCC; see the file COPYING3.  If not see
     <http://www.gnu.org/licenses/>.  */
  
+ /* defaults.h requires HAVE_INITFINI_ARRAY_SUPPORT to be present
+    in order for attribute "retain" to be recognized.  This is due
+    to some quirks in crtstuff.h -- which isn't even used by avr.
+    All we need is that Binutils supports the "R"etain section flag.
+    If that's the case, define SUPPORTS_SHF_GNU_RETAIN so that
+    defaults.h doesn't define it to 0.  */
+ #if defined(IN_GCC) && !defined(USED_FOR_TARGET) && !defined(GENERATOR_FILE)
+ #include "auto-host.h" /* HAVE_GAS_SHF_GNU_RETAIN */
+ #if HAVE_GAS_SHF_GNU_RETAIN
+ #undef SUPPORTS_SHF_GNU_RETAIN
+ #define SUPPORTS_SHF_GNU_RETAIN 1
+ #endif
+ #endif
  
  /* Overriding some definitions from elfos.h for AVR.  */
  
diff -Nrcpad gcc-13-20251030/gcc/testsuite/ChangeLog gcc-13-20251106/gcc/testsuite/ChangeLog
*** gcc-13-20251030/gcc/testsuite/ChangeLog	Thu Oct 30 22:32:16 2025
--- gcc-13-20251106/gcc/testsuite/ChangeLog	Thu Nov  6 22:32:22 2025
***************
*** 1,3 ****
--- 1,53 ----
+ 2025-10-31  Richard Biener  <rguenther@suse.de>
+ 
+ 	Backported from master:
+ 	2025-09-11  Richard Biener  <rguenther@suse.de>
+ 
+ 	PR tree-optimization/121870
+ 	* g++.dg/torture/pr121870.C: New testcase.
+ 
+ 2025-10-31  Richard Biener  <rguenther@suse.de>
+ 
+ 	Backported from master:
+ 	2025-10-14  Richard Biener  <rguenther@suse.de>
+ 
+ 	PR tree-optimization/121256
+ 	* gcc.dg/vect/vect-recurr-pr121256.c: New testcase.
+ 	* gcc.dg/vect/vect-recurr-pr121256-2.c: Likewise.
+ 
+ 2025-10-31  Richard Biener  <rguenther@suse.de>
+ 
+ 	Backported from master:
+ 	2025-10-14  Richard Biener  <rguenther@suse.de>
+ 		    Richard Sandiford   <richard.sandiford@arm.com>
+ 
+ 	PR tree-optimization/121059
+ 	* gcc.dg/vect/pr121059.c: New testcase.
+ 
+ 2025-10-31  Richard Biener  <rguenther@suse.de>
+ 
+ 	Backported from master:
+ 	2025-07-04  Richard Biener  <rguenther@suse.de>
+ 
+ 	PR tree-optimization/120944
+ 	* gcc.dg/torture/pr120944.c: New testcase.
+ 
+ 2025-10-31  Tamar Christina  <tamar.christina@arm.com>
+ 
+ 	Backported from master:
+ 	2025-07-07  Tamar Christina  <tamar.christina@arm.com>
+ 
+ 	PR tree-optimization/120817
+ 	* gcc.dg/vect/pr120817.c: Add SVE HW check.
+ 
+ 2025-10-31  Richard Biener  <rguenther@suse.de>
+ 
+ 	Backported from master:
+ 	2025-07-07  Richard Biener  <rguenther@suse.de>
+ 
+ 	PR tree-optimization/120817
+ 	* gcc.dg/vect/pr120817.c: New testcase.
+ 
  2025-10-20  Eric Botcazou  <ebotcazou@adacore.com>
  
  	* gnat.dg/renaming18.adb: New test.
diff -Nrcpad gcc-13-20251030/gcc/testsuite/g++.dg/torture/pr121870.C gcc-13-20251106/gcc/testsuite/g++.dg/torture/pr121870.C
*** gcc-13-20251030/gcc/testsuite/g++.dg/torture/pr121870.C	Thu Jan  1 00:00:00 1970
--- gcc-13-20251106/gcc/testsuite/g++.dg/torture/pr121870.C	Thu Nov  6 22:32:24 2025
***************
*** 0 ****
--- 1,20 ----
+ __attribute__((noreturn)) void f1(void)
+ {
+     while(true) {}
+ }
+ static void (*fptr)(void) = f1;
+ struct s1
+ {
+     ~s1() {
+         fptr();
+     }
+     void DoInner() {
+         fptr();
+     }
+ };
+ 
+ void f()
+ {
+     s1 xxx;
+     xxx.DoInner();
+ }
diff -Nrcpad gcc-13-20251030/gcc/testsuite/gcc.dg/torture/pr120944.c gcc-13-20251106/gcc/testsuite/gcc.dg/torture/pr120944.c
*** gcc-13-20251030/gcc/testsuite/gcc.dg/torture/pr120944.c	Thu Jan  1 00:00:00 1970
--- gcc-13-20251106/gcc/testsuite/gcc.dg/torture/pr120944.c	Thu Nov  6 22:32:39 2025
***************
*** 0 ****
--- 1,34 ----
+ /* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
+ /* { dg-additional-options "-fdump-tree-optimized" } */
+ 
+ #include <stdlib.h>
+ 
+ typedef union {
+   int u32;
+   struct
+   {
+      int A:1;
+      int B:2;
+      int C:3;
+   };
+ } u_t;
+ 
+ typedef union {
+    volatile int u[3];
+    volatile struct {
+         u_t a;
+         int b;
+         int c;
+    };
+ } DATA;
+ 
+ void foo (volatile DATA *d)
+ {
+      d->a.u32 = ~0;
+      u_t u = d->a;
+      int v = u.A;
+      if (v)
+         abort();
+ }
+ 
+ /* { dg-final { scan-tree-dump-times "if \\\(" 1 "optimized" } } */
diff -Nrcpad gcc-13-20251030/gcc/testsuite/gcc.dg/vect/pr120817.c gcc-13-20251106/gcc/testsuite/gcc.dg/vect/pr120817.c
*** gcc-13-20251030/gcc/testsuite/gcc.dg/vect/pr120817.c	Thu Jan  1 00:00:00 1970
--- gcc-13-20251106/gcc/testsuite/gcc.dg/vect/pr120817.c	Thu Nov  6 22:32:44 2025
***************
*** 0 ****
--- 1,41 ----
+ /* { dg-additional-options "-O1" } */
+ /* { dg-require-effective-target aarch64_sve_hw { target aarch64*-*-* } } */
+ /* { dg-additional-options "-march=armv8-a+sve -mtune=neoverse-n2" { target aarch64*-*-* } } */
+ 
+ #include "tree-vect.h"
+ 
+ typedef struct {
+     int _M_current;
+ } __normal_iterator;
+ 
+ typedef struct {
+     char _M_elems[5];
+ } array_5;
+ 
+ __normal_iterator __trans_tmp_1 = {-5};
+ 
+ __attribute__((noipa))
+ array_5 copySourceIntoTarget() {
+     array_5 target;
+     char* target_it = target._M_elems;
+ 
+     while (__trans_tmp_1._M_current != 0) {
+         *target_it = 1;
+         __trans_tmp_1._M_current++;
+         target_it++;
+     }
+ 
+     return target;
+ }
+ 
+ int main ()
+ {
+   check_vect ();
+ 
+   array_5 res = copySourceIntoTarget();
+ 
+ #pragma GCC novector
+   for (int i = 0; i < 5; i++)
+     if (res._M_elems[i] != 1)
+       __builtin_abort ();
+ }
diff -Nrcpad gcc-13-20251030/gcc/testsuite/gcc.dg/vect/pr121059.c gcc-13-20251106/gcc/testsuite/gcc.dg/vect/pr121059.c
*** gcc-13-20251030/gcc/testsuite/gcc.dg/vect/pr121059.c	Thu Jan  1 00:00:00 1970
--- gcc-13-20251106/gcc/testsuite/gcc.dg/vect/pr121059.c	Thu Nov  6 22:32:44 2025
***************
*** 0 ****
--- 1,24 ----
+ /* { dg-do compile } */
+ /* { dg-additional-options "-O3 --param vect-partial-vector-usage=1" } */
+ /* { dg-additional-options "-march=x86-64-v4" { target avx512f } } */
+ 
+ typedef struct {
+   long left, right, top, bottom;
+ } MngBox;
+ typedef struct {
+   MngBox object_clip[6];
+   char exists[256], frozen[];
+ } MngReadInfo;
+ MngReadInfo mng_info;
+ 
+ long ReadMNGImage_i;
+ 
+ void ReadMNGImage(int ReadMNGImage_i)
+ {
+   for (; ReadMNGImage_i < 256; ReadMNGImage_i++)
+     if (mng_info.exists[ReadMNGImage_i] && mng_info.frozen[ReadMNGImage_i])
+       mng_info.object_clip[ReadMNGImage_i].left =
+           mng_info.object_clip[ReadMNGImage_i].right =
+               mng_info.object_clip[ReadMNGImage_i].top =
+                   mng_info.object_clip[ReadMNGImage_i].bottom = 0;
+ }
diff -Nrcpad gcc-13-20251030/gcc/testsuite/gcc.dg/vect/vect-recurr-pr121256-2.c gcc-13-20251106/gcc/testsuite/gcc.dg/vect/vect-recurr-pr121256-2.c
*** gcc-13-20251030/gcc/testsuite/gcc.dg/vect/vect-recurr-pr121256-2.c	Thu Jan  1 00:00:00 1970
--- gcc-13-20251106/gcc/testsuite/gcc.dg/vect/vect-recurr-pr121256-2.c	Thu Nov  6 22:32:45 2025
***************
*** 0 ****
--- 1,49 ----
+ /* { dg-additional-options "-mavx2" { target avx2_runtime } } */
+ 
+ #include "tree-vect.h"
+ 
+ #define B 0
+ #define G 1
+ #define R 2
+ 
+ int red = 153;
+ int green = 66;
+ int blue = 187;
+ 
+ static void __attribute__((noipa))
+ sub_left_prediction_bgr32(int *restrict dst, int *restrict src)
+ {
+   for (int i = 0; i < 8; i++) {
+     int rt = src[i * 3 + R];
+     int gt = src[i * 3 + G];
+     int bt = src[i * 3 + B];
+ 
+     dst[i * 3 + R] = rt - red;
+     dst[i * 3 + G] = gt - green;
+     dst[i * 3 + B] = bt - blue;
+ 
+     red = rt;
+     green = gt;
+     blue = bt;
+   }
+ }
+ 
+ int main()
+ {
+   int dst[8*3];
+   int src[8*3] = { 160, 73, 194, 17, 33, 99, 0, 12, 283, 87, 73, 11,
+ 		   9, 7, 1, 23, 19, 13, 77, 233, 97, 78, 2, 5 };
+   int dst2[8*3] = {-27, 7, 41, -143, -40, -95, -17, -21, 184, 87, 61,
+       -272, -78, -66, -10, 14, 12, 12, 54, 214, 84, 1, -231, -92};
+ 
+   check_vect ();
+ 
+   sub_left_prediction_bgr32(dst, src);
+ 
+ #pragma GCC novector
+   for (int i = 0; i < 8*3; ++i)
+     if (dst[i] != dst2[i])
+       __builtin_abort();
+ 
+   return 0;
+ }
diff -Nrcpad gcc-13-20251030/gcc/testsuite/gcc.dg/vect/vect-recurr-pr121256.c gcc-13-20251106/gcc/testsuite/gcc.dg/vect/vect-recurr-pr121256.c
*** gcc-13-20251030/gcc/testsuite/gcc.dg/vect/vect-recurr-pr121256.c	Thu Jan  1 00:00:00 1970
--- gcc-13-20251106/gcc/testsuite/gcc.dg/vect/vect-recurr-pr121256.c	Thu Nov  6 22:32:45 2025
***************
*** 0 ****
--- 1,54 ----
+ /* { dg-additional-options "-mavx2" { target avx2_runtime } } */
+ 
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <stdlib.h>
+ #include "tree-vect.h"
+ 
+ #define B 0
+ #define G 1
+ #define R 2
+ #define A 3
+ 
+ int red = 153;
+ int green = 66;
+ int blue = 187;
+ int alpha = 255;
+ 
+ static void __attribute__((noipa))
+ sub_left_prediction_bgr32(uint8_t *restrict dst, uint8_t *restrict src, int w)
+ {
+   for (int i = 0; i < 8; i++) {
+     int rt = src[i * 4 + R];
+     int gt = src[i * 4 + G];
+     int bt = src[i * 4 + B];
+     int at = src[i * 4 + A];
+ 
+     dst[i * 4 + R] = rt - red;
+     dst[i * 4 + G] = gt - green;
+     dst[i * 4 + B] = bt - blue;
+     dst[i * 4 + A] = at - alpha;
+ 
+     red = rt;
+     green = gt;
+     blue = bt;
+     alpha = at;
+   }
+ }
+ 
+ int main()
+ {
+   check_vect ();
+ 
+   uint8_t *dst = calloc(36, sizeof(uint8_t));
+   uint8_t *src = calloc(36, sizeof(uint8_t));
+ 
+   src[R] = 160;
+   src[G] = 73;
+   src[B] = 194;
+   src[A] = 255;
+ 
+   sub_left_prediction_bgr32(dst, src, 33);
+   if (dst[R] != 7 || dst[B] != 7 || dst[A] != 0)
+     __builtin_abort();
+ }
diff -Nrcpad gcc-13-20251030/gcc/tree-ssa-dse.cc gcc-13-20251106/gcc/tree-ssa-dse.cc
*** gcc-13-20251030/gcc/tree-ssa-dse.cc	Thu Oct 30 22:33:19 2025
--- gcc-13-20251106/gcc/tree-ssa-dse.cc	Thu Nov  6 22:33:16 2025
*************** initialize_ao_ref_for_dse (gimple *stmt,
*** 169,177 ****
  	     can provide a may-def variant.  */
  	  if (may_def_ok)
  	    {
! 	      ao_ref_init_from_ptr_and_size
! 		  (write, gimple_call_arg (stmt, 0),
! 		   TYPE_SIZE_UNIT (TREE_TYPE (gimple_call_arg (stmt, 3))));
  	      return true;
  	    }
  	  break;
--- 169,178 ----
  	     can provide a may-def variant.  */
  	  if (may_def_ok)
  	    {
! 	      ao_ref_init_from_ptr_and_range (
! 		  write, gimple_call_arg (stmt, 0), true, 0, -1,
! 		  tree_to_poly_int64 (TYPE_SIZE (
! 		    TREE_TYPE (gimple_call_arg (stmt, 3)))));
  	      return true;
  	    }
  	  break;
diff -Nrcpad gcc-13-20251030/gcc/tree-ssa-propagate.cc gcc-13-20251106/gcc/tree-ssa-propagate.cc
*** gcc-13-20251030/gcc/tree-ssa-propagate.cc	Thu Oct 30 22:33:19 2025
--- gcc-13-20251106/gcc/tree-ssa-propagate.cc	Thu Nov  6 22:33:17 2025
*************** substitute_and_fold_engine::substitute_a
*** 1006,1011 ****
--- 1006,1013 ----
    while (!walker.stmts_to_fixup.is_empty ())
      {
        gimple *stmt = walker.stmts_to_fixup.pop ();
+       if (!gimple_bb (stmt))
+ 	continue;
        if (dump_file && dump_flags & TDF_DETAILS)
  	{
  	  fprintf (dump_file, "Fixing up noreturn call ");
diff -Nrcpad gcc-13-20251030/gcc/tree-ssa-sccvn.cc gcc-13-20251106/gcc/tree-ssa-sccvn.cc
*** gcc-13-20251030/gcc/tree-ssa-sccvn.cc	Thu Oct 30 22:33:19 2025
--- gcc-13-20251106/gcc/tree-ssa-sccvn.cc	Thu Nov  6 22:33:17 2025
*************** vn_reference_lookup_3 (ao_ref *ref, tree
*** 2758,2764 ****
           we find a VN result with exactly the same value as the
  	 possible clobber.  In this case we can ignore the clobber
  	 and return the found value.  */
!       if (is_gimple_reg_type (TREE_TYPE (lhs))
  	  && types_compatible_p (TREE_TYPE (lhs), vr->type)
  	  && (ref->ref || data->orig_ref.ref)
  	  && !data->mask
--- 2758,2765 ----
           we find a VN result with exactly the same value as the
  	 possible clobber.  In this case we can ignore the clobber
  	 and return the found value.  */
!       if (!gimple_has_volatile_ops (def_stmt)
! 	  && is_gimple_reg_type (TREE_TYPE (lhs))
  	  && types_compatible_p (TREE_TYPE (lhs), vr->type)
  	  && (ref->ref || data->orig_ref.ref)
  	  && !data->mask
*************** vn_reference_lookup_3 (ao_ref *ref, tree
*** 3036,3042 ****
    else if (is_gimple_reg_type (vr->type)
  	   && gimple_assign_single_p (def_stmt)
  	   && gimple_assign_rhs_code (def_stmt) == CONSTRUCTOR
! 	   && CONSTRUCTOR_NELTS (gimple_assign_rhs1 (def_stmt)) == 0)
      {
        tree base2;
        poly_int64 offset2, size2, maxsize2;
--- 3037,3044 ----
    else if (is_gimple_reg_type (vr->type)
  	   && gimple_assign_single_p (def_stmt)
  	   && gimple_assign_rhs_code (def_stmt) == CONSTRUCTOR
! 	   && CONSTRUCTOR_NELTS (gimple_assign_rhs1 (def_stmt)) == 0
! 	   && !TREE_THIS_VOLATILE (gimple_assign_lhs (def_stmt)))
      {
        tree base2;
        poly_int64 offset2, size2, maxsize2;
*************** vn_reference_lookup_3 (ao_ref *ref, tree
*** 3092,3097 ****
--- 3094,3100 ----
  	   && !reverse_storage_order_for_component_p (vr->operands)
  	   && !contains_storage_order_barrier_p (vr->operands)
  	   && gimple_assign_single_p (def_stmt)
+ 	   && !TREE_THIS_VOLATILE (gimple_assign_lhs (def_stmt))
  	   && CHAR_BIT == 8
  	   && BITS_PER_UNIT == 8
  	   && BYTES_BIG_ENDIAN == WORDS_BIG_ENDIAN
*************** vn_reference_lookup_3 (ao_ref *ref, tree
*** 3245,3250 ****
--- 3248,3254 ----
  	   && !reverse_storage_order_for_component_p (vr->operands)
  	   && !contains_storage_order_barrier_p (vr->operands)
  	   && gimple_assign_single_p (def_stmt)
+ 	   && !TREE_THIS_VOLATILE (gimple_assign_lhs (def_stmt))
  	   && TREE_CODE (gimple_assign_rhs1 (def_stmt)) == SSA_NAME)
      {
        tree lhs = gimple_assign_lhs (def_stmt);
*************** vn_reference_lookup_3 (ao_ref *ref, tree
*** 3453,3458 ****
--- 3457,3463 ----
       the copy kills ref.  */
    else if (data->vn_walk_kind == VN_WALKREWRITE
  	   && gimple_assign_single_p (def_stmt)
+ 	   && !gimple_has_volatile_ops (def_stmt)
  	   && (DECL_P (gimple_assign_rhs1 (def_stmt))
  	       || TREE_CODE (gimple_assign_rhs1 (def_stmt)) == MEM_REF
  	       || handled_component_p (gimple_assign_rhs1 (def_stmt))))
diff -Nrcpad gcc-13-20251030/gcc/tree-vect-loop.cc gcc-13-20251106/gcc/tree-vect-loop.cc
*** gcc-13-20251030/gcc/tree-vect-loop.cc	Thu Oct 30 22:33:19 2025
--- gcc-13-20251106/gcc/tree-vect-loop.cc	Thu Nov  6 22:33:17 2025
*************** vectorizable_recurr (loop_vec_info loop_
*** 8444,8449 ****
--- 8444,8479 ----
        return false;
      }
  
+   /* We need to be able to build a { ..., a, b } init vector with
+      dist number of distinct trailing values.  Always possible
+      when dist == 1 or when nunits is constant or when the initializations
+      are uniform.  */
+   tree uniform_initval = NULL_TREE;
+   edge pe = loop_preheader_edge (LOOP_VINFO_LOOP (loop_vinfo));
+   if (slp_node)
+     for (stmt_vec_info s : SLP_TREE_SCALAR_STMTS (slp_node))
+       {
+ 	gphi *phi = as_a <gphi *> (s->stmt);
+ 	if (! uniform_initval)
+ 	  uniform_initval = PHI_ARG_DEF_FROM_EDGE (phi, pe);
+ 	else if (! operand_equal_p (uniform_initval,
+ 				    PHI_ARG_DEF_FROM_EDGE (phi, pe)))
+ 	  {
+ 	    uniform_initval = NULL_TREE;
+ 	    break;
+ 	  }
+       }
+   else
+     uniform_initval = PHI_ARG_DEF_FROM_EDGE (phi, pe);
+   if (!uniform_initval && !nunits.is_constant ())
+     {
+       if (dump_enabled_p ())
+ 	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ 			 "cannot build initialization vector for "
+ 			 "first order recurrence\n");
+       return false;
+     }
+ 
    /* First-order recurrence autovectorization needs to handle permutation
       with indices = [nunits-1, nunits, nunits+1, ...].  */
    vec_perm_builder sel (nunits, 1, 3);
*************** vectorizable_recurr (loop_vec_info loop_
*** 8490,8510 ****
        return true;
      }
  
!   edge pe = loop_preheader_edge (LOOP_VINFO_LOOP (loop_vinfo));
!   basic_block bb = gimple_bb (phi);
!   tree preheader = PHI_ARG_DEF_FROM_EDGE (phi, pe);
!   if (!useless_type_conversion_p (TREE_TYPE (vectype), TREE_TYPE (preheader)))
      {
!       gimple_seq stmts = NULL;
!       preheader = gimple_convert (&stmts, TREE_TYPE (vectype), preheader);
!       gsi_insert_seq_on_edge_immediate (pe, stmts);
      }
!   tree vec_init = build_vector_from_val (vectype, preheader);
    vec_init = vect_init_vector (loop_vinfo, stmt_info, vec_init, vectype, NULL);
  
    /* Create the vectorized first-order PHI node.  */
    tree vec_dest = vect_get_new_vect_var (vectype,
  					 vect_simple_var, "vec_recur_");
    gphi *new_phi = create_phi_node (vec_dest, bb);
    add_phi_arg (new_phi, vec_init, pe, UNKNOWN_LOCATION);
  
--- 8520,8557 ----
        return true;
      }
  
!   tree vec_init;
!   if (! uniform_initval)
      {
!       vec<constructor_elt, va_gc> *v = NULL;
!       vec_alloc (v, nunits.to_constant ());
!       for (unsigned i = 0; i < nunits.to_constant () - dist; ++i)
! 	CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
! 				build_zero_cst (TREE_TYPE (vectype)));
!       for (stmt_vec_info s : SLP_TREE_SCALAR_STMTS (slp_node))
! 	{
! 	  gphi *phi = as_a <gphi *> (s->stmt);
! 	  tree preheader = PHI_ARG_DEF_FROM_EDGE (phi, pe);
! 	  if (!useless_type_conversion_p (TREE_TYPE (vectype),
! 					  TREE_TYPE (preheader)))
! 	    {
! 	      gimple_seq stmts = NULL;
! 	      preheader = gimple_convert (&stmts,
! 					  TREE_TYPE (vectype), preheader);
! 	      gsi_insert_seq_on_edge_immediate (pe, stmts);
! 	    }
! 	  CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, preheader);
! 	}
!       vec_init = build_constructor (vectype, v);
      }
!   else
!     vec_init = uniform_initval;
    vec_init = vect_init_vector (loop_vinfo, stmt_info, vec_init, vectype, NULL);
  
    /* Create the vectorized first-order PHI node.  */
    tree vec_dest = vect_get_new_vect_var (vectype,
  					 vect_simple_var, "vec_recur_");
+   basic_block bb = gimple_bb (phi);
    gphi *new_phi = create_phi_node (vec_dest, bb);
    add_phi_arg (new_phi, vec_init, pe, UNKNOWN_LOCATION);
  
diff -Nrcpad gcc-13-20251030/gcc/tree-vect-stmts.cc gcc-13-20251106/gcc/tree-vect-stmts.cc
*** gcc-13-20251030/gcc/tree-vect-stmts.cc	Thu Oct 30 22:33:19 2025
--- gcc-13-20251106/gcc/tree-vect-stmts.cc	Thu Nov  6 22:33:17 2025
*************** vectorizable_operation (vec_info *vinfo,
*** 6170,6176 ****
    poly_uint64 nunits_in;
    poly_uint64 nunits_out;
    tree vectype_out;
!   int ncopies, vec_num;
    int i;
    vec<tree> vec_oprnds0 = vNULL;
    vec<tree> vec_oprnds1 = vNULL;
--- 6170,6177 ----
    poly_uint64 nunits_in;
    poly_uint64 nunits_out;
    tree vectype_out;
!   unsigned int ncopies;
!   unsigned vec_num;
    int i;
    vec<tree> vec_oprnds0 = vNULL;
    vec<tree> vec_oprnds1 = vNULL;
*************** vectorizable_operation (vec_info *vinfo,
*** 6626,6633 ****
  	      && code == BIT_AND_EXPR
  	      && VECTOR_BOOLEAN_TYPE_P (vectype))
  	    {
! 	      if (loop_vinfo->scalar_cond_masked_set.contains ({ op0,
! 								 ncopies}))
  		{
  		  mask = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
  					     vectype, i);
--- 6627,6634 ----
  	      && code == BIT_AND_EXPR
  	      && VECTOR_BOOLEAN_TYPE_P (vectype))
  	    {
! 	      if (loop_vinfo->scalar_cond_masked_set.contains
! 						   ({ op0, vec_num * ncopies}))
  		{
  		  mask = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
  					     vectype, i);
*************** vectorizable_operation (vec_info *vinfo,
*** 6636,6643 ****
  					   vop0, gsi);
  		}
  
! 	      if (loop_vinfo->scalar_cond_masked_set.contains ({ op1,
! 								 ncopies }))
  		{
  		  mask = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
  					     vectype, i);
--- 6637,6644 ----
  					   vop0, gsi);
  		}
  
! 	      if (loop_vinfo->scalar_cond_masked_set.contains
! 						  ({ op1, vec_num * ncopies }))
  		{
  		  mask = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
  					     vectype, i);
