[ARM] Don't aggressively unroll vector remainder loops
authorDavid Green <david.green@arm.com>
Tue, 10 Nov 2020 17:01:31 +0000 (17:01 +0000)
committerDavid Green <david.green@arm.com>
Tue, 10 Nov 2020 17:01:31 +0000 (17:01 +0000)
commitc7e275388e3fe55163296e587eff1b6325b63da2
tree59cb5074ecbeca9e26ad2e3ea8cc9c2300bb2723
parent85cd7ffade202e917c8109dd787f80a10e5c0dfb
[ARM] Don't aggressively unroll vector remainder loops

We already do not unroll loops with vector instructions under MVE, but
that does not include the remainder loops that the vectorizer produces.
These remainder loops will be rarely executed and are not worth
unrolling, as the trip count is likely to be low if they get executed at
all. Luckily they get llvm.loop.isvectorized to make recognizing them
simpler.

We have wanted to do this for a while but hit issues with low overhead
loops being reverted due to difficult registry allocation. With recent
changes that seems to be less of an issue now.

Differential Revision: https://reviews.llvm.org/D90055
llvm/include/llvm/Transforms/Utils/LoopUtils.h
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
llvm/lib/Transforms/Utils/LoopUtils.cpp
llvm/test/Transforms/LoopUnroll/ARM/mve-nounroll.ll