[PATCH] D41096: [X86] Initial support for prefer-vector-width function attribute

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 12:23:54 PST 2017


hfinkel added a comment.

In https://reviews.llvm.org/D41096#952748, @craig.topper wrote:

> @hfinkel, sorry our updates passed each other.
>
> I see your point, we shouldn't release the preference just because the user did something explicit. So in that case we would need to unconstrain the legalizer, but still keep the TTI interface reporting 256 so the vectorizer won't go out of its way to generate large vectors in the same function. And potentially add more cost modeling enhancements and potentially spot fixes into the codegen lowering.
>
> So we probably do need another function attribute to indicate the safe width for the legalizer.


I think that we should have the preference separate from legalization, but also have hard cap that the vectorizer uses. The vectorizer will generate larger vectors than the current max for loops with a mixture of types, under the assumption that it's better to fill the vectors of the smaller types, even if that means legalization splitting for the vectors of larger types. We could cap this behavior, or have the vectorizer do manual legalization in that case. I think that the latter is probably the best that we can do (but a cap will do in the mean time).


https://reviews.llvm.org/D41096





More information about the llvm-commits mailing list