summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
diff options
context:
space:
mode:
authorMichael Kuperstein <mkuper@google.com>2016-12-19 22:47:52 +0000
committerMichael Kuperstein <mkuper@google.com>2016-12-19 22:47:52 +0000
commitfb7dd86fd667fa24dfb2bc2bb323d976058816e8 (patch)
tree6a91e58ce9cf94ca15161a3eac63f1df99c8f1ff /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
parent281139c159cc26a6e7aadcab25e607ea43aaae65 (diff)
downloadbcm5719-llvm-fb7dd86fd667fa24dfb2bc2bb323d976058816e8.tar.gz
bcm5719-llvm-fb7dd86fd667fa24dfb2bc2bb323d976058816e8.zip
[LV] Sink tripcount query to where it's actually used. NFC.
llvm-svn: 290142
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 70269ed61f5..8cde0c4cd60 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6089,10 +6089,6 @@ LoopVectorizationCostModel::selectVectorizationFactor(bool OptForSize) {
return Factor;
}
- // Find the trip count.
- unsigned TC = PSE.getSE()->getSmallConstantTripCount(TheLoop);
- DEBUG(dbgs() << "LV: Found trip count: " << TC << '\n');
-
MinBWs = computeMinimumValueSizes(TheLoop->getBlocks(), *DB, &TTI);
unsigned SmallestType, WidestType;
std::tie(SmallestType, WidestType) = getSmallestAndWidestTypes();
@@ -6150,7 +6146,10 @@ LoopVectorizationCostModel::selectVectorizationFactor(bool OptForSize) {
// If we optimize the program for size, avoid creating the tail loop.
if (OptForSize) {
- // If we are unable to calculate the trip count then don't try to vectorize.
+ unsigned TC = PSE.getSE()->getSmallConstantTripCount(TheLoop);
+ DEBUG(dbgs() << "LV: Found trip count: " << TC << '\n');
+
+ // If we don't know the precise trip count, don't try to vectorize.
if (TC < 2) {
ORE->emit(
createMissedAnalysis("UnknownLoopCountComplexCFG")
OpenPOWER on IntegriCloud