https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120164
--- Comment #3 from Tamar Christina <tnfchris at gcc dot gnu.org> --- (In reply to Tamar Christina from comment #2) > (In reply to Richard Biener from comment #1) > > As of today this is a job for the vectorizer if-conversion pass then. > > > > OTOH I believe we should work towards vectorizing the prefetches themselves > > rather than dropping them on the floor. We'll also happily keep the > > prefetches in the prologue/epilogue peeled copies which doesn't make much > > sense. > > That would definitely have to be a target hook. To clarify a bit more, As Pinksi mentioned in the other PR software prefetching often times interferes with HW prefetching. On older uarches they *could* have provided some benefits as HW prefetching wasn't as advanced. On newer uarches they are typically just ignored. But you do have fetch and decode overhead for essentially dead instructions. Additionally they have more limited addressing modes and can cause secondary effects like IVops picking a less efficient addressing mode for the loads to share the IV of the prefetch instructions. Aside from that certain SVE prefetch instructions are illegal when in SVE streaming mode. But we would still want to vectorize the loops. So we would need to have a target hook to allow us to drop them.