https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106433

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54413
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54413&action=edit
gcc13-pr106433.patch

Seems in this case the set_const_call happens far later, during the
local-pure-const2 pass very soon before expansion into RTL.
The simd clones are created during late IPA, but the cgraph ordering in this
case is that bar is optimized + expanded first, then its caller foo, then the
simd clones of foo and finally the simd clones of bar.  In order to be able to
DCE unneeded simd clones, that is the intended ordering that we process simd
clones only after processing their (possible) callers, so that if we decide not
to use them and they are static, they can go away.

The big question is if it is safe to make those clones const or pure if the
function they are cloned from is.  I'd hope it is, they are created by the
compiler from the functions they were cloned from and they should be just
possibly vectorized versions thereof handling more than one argument
concurrently.  I can imagine we'd be able to determine during optimizations one
is const and couldn't prove it for the other, but I'd say if it is safe for one
version it ought to be safe for another one too.

Reply via email to