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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-08-31
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
           Keywords|                            |missed-optimization,
                   |                            |wrong-code

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Yeah, we modify a copy of the scalar loop in-place, only removing original
stmts that have side-effects, leaving dead code elimination to the followup DCE
pass.  Note we run that immediately after loop vectorization but for SLP
vectorization
there are quite some intermediate passes until we perform DCE, for example
there's IVOPTS which might re-compute number of iterations and at least
max_iteration estimate also looks at undefined behavior.  OTOH with SLP
vectorization we don't change any loop iteration which means the original
stmts only compute the very original values (should, at least).

That means there might be an actual issue for those cases but for loop
vectorization the issue should be moot unless those stmts survive the
DCE pass after it.

I would suggest to "blacklist" analyzing the "vect" dump, the followup "dce"
dump should be fine.

For SLP I'm not sure, I guess no actual problems should show up but we
should maybe try to use simple_dce_from_worklist with the root stmts
original SSA uses (and defs in some cases), possibly the root stmt
vectorization code generation code could gather relevant defs.

So I think, correctness wise it should be a non-issue but it's a bit
ugly also since some fuzzers like to disable DCE which then indeed
would create wrong-code issues.

Reply via email to