[LV] Make sure VF doesn't exceed compile time known TC
authorEvgeniy Brevnov <ybrevnov@azul.com>
Wed, 24 Nov 2021 11:30:52 +0000 (18:30 +0700)
committerEvgeniy Brevnov <ybrevnov@azul.com>
Mon, 13 Dec 2021 06:48:46 +0000 (13:48 +0700)
commit2025e0985c2a1aa481620eef5312d48415b7f8b4
treec0490609739bac8e464db4fe4d03bf93af252b4c
parent9115d75117b57115fe45153e5f38f2c444c0cd91
[LV] Make sure VF doesn't exceed compile time known TC

For the simple copy loop (see test case) vectorizer selects VF equal to 32 while the loop is known to have 17 iterations only. Such behavior makes no sense to me since such vector loop will never be executed. The only case we may want to select VF large than TC is masked vectoriztion. So I haven't touched that case.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D114528
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/X86/limit-vf-by-tripcount.ll