summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDiego Caballero <diego.caballero@intel.com>2018-06-15 16:21:35 +0000
committerDiego Caballero <diego.caballero@intel.com>2018-06-15 16:21:35 +0000
commit68795245cfb3ca1d3c6ddb7e87ed8165de20dbef (patch)
treef38d08087348c1c1db404c66afee7183a797398c /llvm/lib/Transforms
parent6927cf0c2ae41e607883c453ce81f82bb922ff48 (diff)
downloadbcm5719-llvm-68795245cfb3ca1d3c6ddb7e87ed8165de20dbef.tar.gz
bcm5719-llvm-68795245cfb3ca1d3c6ddb7e87ed8165de20dbef.zip
[LV] Prevent LV to run cost model twice for VF=2
This is a minor fix for LV cost model, where the cost for VF=2 was computed twice when the vectorization of the loop was forced without specifying a VF. Reviewers: xusx595, hsaito, fhahn, mkuper Reviewed By: hsaito, xusx595 Differential Revision: https://reviews.llvm.org/D48048 llvm-svn: 334840
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index a9f1ba3d343..8a0d96a9411 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5022,10 +5022,11 @@ LoopVectorizationCostModel::selectVectorizationFactor(unsigned MaxVF) {
LLVM_DEBUG(dbgs() << "LV: Scalar loop costs: " << (int)ScalarCost << ".\n");
bool ForceVectorization = Hints->getForce() == LoopVectorizeHints::FK_Enabled;
- // Ignore scalar width, because the user explicitly wants vectorization.
if (ForceVectorization && MaxVF > 1) {
- Width = 2;
- Cost = expectedCost(Width).first / (float)Width;
+ // Ignore scalar width, because the user explicitly wants vectorization.
+ // Initialize cost to max so that VF = 2 is, at least, chosen during cost
+ // evaluation.
+ Cost = std::numeric_limits<float>::max();
}
for (unsigned i = 2; i <= MaxVF; i *= 2) {
OpenPOWER on IntegriCloud