https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102756
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- I think the behavior is as expected ... PRE is avoided because of vectorization and the unroll costing correctly sees the single less stmt being needed (which is of course now on the preheader edge). Looks like the testcase was on-the-edge as far as unrolling is concerned. Note one of the major issue with vectorization at -O2 is that it indeed affects what we do in PRE where we could improve heuristics of course. In this case there's multiple exits in the loop which prevents vectorization anyway, but we might just have optimized that away (we're in the elimination phase).