https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91838
--- Comment #21 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Andre Simoes Dias Vieira <avie...@gcc.gnu.org>: https://gcc.gnu.org/g:c6e171ff827f8ff1bd160babac0dd24933972664 commit r13-8498-gc6e171ff827f8ff1bd160babac0dd24933972664 Author: Richard Biener <rguent...@suse.de> Date: Thu Jul 27 13:08:32 2023 +0200 tree-optimization/91838 - fix FAIL of g++.dg/opt/pr91838.C The following fixes the lack of simplification of a vector shift by an out-of-bounds shift value. For scalars this is done both by CCP and VRP but vectors are not handled there. This results in PR91838 differences in outcome dependent on whether a vector shift ISA is available and thus vector lowering does or does not expose scalar shifts here. The following adds a match.pd pattern to catch uniform out-of-bound shifts, simplifying them to zero when not sanitizing shift amounts. PR tree-optimization/91838 * gimple-match-head.cc: Include attribs.h and asan.h. * generic-match-head.cc: Likewise. * match.pd (([rl]shift @0 out-of-bounds) -> zero): New pattern. (cherry picked from commit d1c072a1c3411a6fe29900750b38210af8451eeb)