summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2013-07-22 17:10:48 +0000
committerNadav Rotem <nrotem@apple.com>2013-07-22 17:10:48 +0000
commit8c45d4b27fbd55728aacadda29f06982af62f358 (patch)
treead479cb6df9ba38aa052996a6f5615e7ee3b0b4a /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
parent0b76dd85ea3cd60d7a7c8128215c40828f15abf4 (diff)
downloadbcm5719-llvm-8c45d4b27fbd55728aacadda29f06982af62f358.tar.gz
bcm5719-llvm-8c45d4b27fbd55728aacadda29f06982af62f358.zip
Fix an obvious typo in the loop vectorizer where the cost model uses the wrong variable. The variable BlockCost is ignored.
We don't have tests for the effect of if-conversion loops because it requires a big test (that includes if-converted loops) and it is difficult to find and balance a loop to do the right thing. llvm-svn: 186845
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 4f6ab069b22..46a63c2d4ba 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4390,7 +4390,7 @@ unsigned LoopVectorizationCostModel::expectedCost(unsigned VF) {
continue;
unsigned C = getInstructionCost(it, VF);
- Cost += C;
+ BlockCost += C;
DEBUG(dbgs() << "LV: Found an estimated cost of "<< C <<" for VF " <<
VF << " For instruction: "<< *it << "\n");
}
@@ -4398,7 +4398,7 @@ unsigned LoopVectorizationCostModel::expectedCost(unsigned VF) {
// We assume that if-converted blocks have a 50% chance of being executed.
// When the code is scalar then some of the blocks are avoided due to CF.
// When the code is vectorized we execute all code paths.
- if (Legal->blockNeedsPredication(*bb) && VF == 1)
+ if (VF == 1 && Legal->blockNeedsPredication(*bb))
BlockCost /= 2;
Cost += BlockCost;
OpenPOWER on IntegriCloud