https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108979
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Richard Sandiford <[email protected]>: https://gcc.gnu.org/g:076d309e36c682176e9f85dc8593e6f2c9e6e75f commit r13-6418-g076d309e36c682176e9f85dc8593e6f2c9e6e75f Author: Richard Sandiford <[email protected]> Date: Thu Mar 2 16:39:50 2023 +0000 vect: Don't apply masks to operations on invariants [PR108979] The loop body in the testcase contains an operation on invariants. SLP detects this and can hoist/schedule the operation outside of the loop. However, after the fix for PR96373, we would try to apply a loop mask to this operation, even though the mask is defined in the loop. The patch does what Richi suggested in the PR: suppress the masking for externs and constants. gcc/ PR tree-optimization/108979 * tree-vect-stmts.cc (vectorizable_operation): Don't mask operations on invariants. gcc/testsuite/ PR tree-optimization/108979 * gfortran.dg/vect/pr108979.f90: New test.
