https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128907
Robin Dapp <rdapp at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2026-11-20
Status|UNCONFIRMED |NEW
--- Comment #1 from Robin Dapp <rdapp at gcc dot gnu.org> ---
Yeah, this is known and unfortunate, I should have filed a bug back then...
std::find used to be 4x "hand-unrolled" in GCC 14 which got removed with the
expectation that backends can use early break and do their own thing WRT
optimizing that loop. Later we re-added unrolling by #pragma unroll 4.
So I think the real regression is even against GCC 14 (at least for some cores,
not sure about Ascalon). What you describe is another regression on top :)
So (1) is a purely scalar regression because the RTL-unrolled(?) loop is not as
efficient as the hand-unrolled one.
(2) Is a mixture of several factors:
(2a) Peeling for alignment for the early-break loop (without fault-only-first
loops we need to peel to ensure we don't cross a page).
(2b) Costing VLA vs VLS.
(2c) VLA prolog.
(2d) Scalar epilog for early break. Right now we replay a number of scalar
iterations after breaking. There are patches posted to address this.
I'll look into 2b and 2c to see if there's anything we can improve on the
backend side. I hope 2d is solved soon.
In 2a the peeling code itself might be worse than GCC 14's version due to (1)
on top :) I think this is target independent and might warrant a separate PR
if it doesn't already exist.