https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115120
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |53947 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2024-05-17 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Note this isn't really because of IVCANON but because the IV is live. IVCANON adds a downward counting IV historically to enable RTL doloop transforms. One could argue this should nowadays be IVOPTs job (in the past IVOPTs was done on RTL). So what's really the issue is that IVOPTs does a bad job (I don't really think it even tries) to replace one vector IV with another. We could try to change IVCANON to avoid creating a canonical downward counting IV if one already exists (I don't think it even avoids that case) and also avoid creating a downward counting IV with step -1 when a upward counting IV with step 1 already controls the exit and verify IVOPTs turns it into a downward counting one when profitable. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947 [Bug 53947] [meta-bug] vectorizer missed-optimizations