diff options
author | Sjoerd Meijer <sjoerd.meijer@arm.com> | 2019-11-14 13:10:44 +0000 |
---|---|---|
committer | Sjoerd Meijer <sjoerd.meijer@arm.com> | 2019-11-14 13:10:44 +0000 |
commit | cb47b8783017a76c5f2e4b974cfd6b22c9f1d5ff (patch) | |
tree | 4ccb2ed64e2fabb3f8dd682e27121a263ab88a66 /llvm/lib/Transforms/Vectorize | |
parent | 1c247dd028b368875bc36cd2a9ccc7fd90507776 (diff) | |
download | bcm5719-llvm-cb47b8783017a76c5f2e4b974cfd6b22c9f1d5ff.tar.gz bcm5719-llvm-cb47b8783017a76c5f2e4b974cfd6b22c9f1d5ff.zip |
[LV] PreferPredicateOverEpilog respecting predicate loop hint
The vectoriser queries TTI->preferPredicateOverEpilogue to determine if
tail-folding is preferred for a loop, but it was not respecting loop hint
'predicate' that can disable this, which has now been added. This showed that
we were incorrectly initialising loop hint 'vectorize.predicate.enable' with 0
(i.e. FK_Disabled) but this should have been FK_Undefined, which has been
fixed.
Differential Revision: https://reviews.llvm.org/D70125
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp index f43842be535..109a7506b79 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp @@ -72,7 +72,7 @@ LoopVectorizeHints::LoopVectorizeHints(const Loop *L, Interleave("interleave.count", InterleaveOnlyWhenForced, HK_UNROLL), Force("vectorize.enable", FK_Undefined, HK_FORCE), IsVectorized("isvectorized", 0, HK_ISVECTORIZED), - Predicate("vectorize.predicate.enable", 0, HK_PREDICATE), TheLoop(L), + Predicate("vectorize.predicate.enable", FK_Undefined, HK_PREDICATE), TheLoop(L), ORE(ORE) { // Populate values with existing loop metadata. getHintsFromMetadata(); diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index f8d3d0b8698..af05683273d 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -7433,8 +7433,10 @@ getScalarEpilogueLowering(Function *F, Loop *L, LoopVectorizeHints &Hints, (F->hasOptSize() || llvm::shouldOptimizeForSize(L->getHeader(), PSI, BFI))) SEL = CM_ScalarEpilogueNotAllowedOptSize; - else if (PreferPredicateOverEpilog || Hints.getPredicate() || - TTI->preferPredicateOverEpilogue(L, LI, *SE, *AC, TLI, DT, LAI)) + else if (PreferPredicateOverEpilog || + Hints.getPredicate() == LoopVectorizeHints::FK_Enabled || + (TTI->preferPredicateOverEpilogue(L, LI, *SE, *AC, TLI, DT, LAI) && + Hints.getPredicate() != LoopVectorizeHints::FK_Disabled)) SEL = CM_ScalarEpilogueNotNeededUsePredicate; return SEL; |