https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126225
Bug ID: 126225
Summary: [12/13/14/15/16/17 Regression] Wrong code at -O2 due
to incorrect SLP IV reuse
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: cemakgok at gmail dot com
Target Milestone: ---
Created attachment 65014
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65014&action=edit
Reduced testcase
Godbolt: https://godbolt.org/z/Mbohx7sEn
Wrong code at -O2.
All major versions from 11 to trunk affected. (11 miscompiles at -O3 only)
Compiles correctly with -fno-tree-loop-vectorize.
Bisected to: 092cdbd9198497593fb034971d0f80fc931ab145
("Re-instantiate SLP induction IV CSE")
Vectorizer reuses induction variables across multiple SLP lanes without actualy
verifying that the lanes share the same scalar values.
Sent a patch for it.