[LV] Fix FoldTail under user VF and UF
authorAyal Zaks <ayal.zaks@intel.com>
Sun, 17 May 2020 14:51:03 +0000 (17:51 +0300)
committerAyal Zaks <ayal.zaks@intel.com>
Mon, 18 May 2020 22:32:25 +0000 (01:32 +0300)
commit682e739638a9c569d4c5c358ab75365175a95efc
tree68592704d6cc7ab7bcdd0b83a1224a177021eb15
parenta81f8fb78dcb5d92deab82bb33e5c7f29de8ba48
[LV] Fix FoldTail under user VF and UF

LV considers an internally computed MaxVF to decide if a constant trip-count is
a multiple of any subsequently chosen VF, and conclude that no scalar remainder
iterations (tail) will be left for Fold Tail to handle. If an external VF is
provided via -force-vector-width, it must be considered instead of the internal
MaxVF.
If an external UF is provided via -force-vector-interleave, it too must be
considered in addition to MaxVF or user VF.

Fixes PR45679.

Differential Revision: https://reviews.llvm.org/D80085
llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/pr45679-fold-tail-by-masking.ll [new file with mode: 0644]