summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize
diff options
context:
space:
mode:
authorMatthew Simpson <mssimpso@codeaurora.org>2016-10-13 14:54:31 +0000
committerMatthew Simpson <mssimpso@codeaurora.org>2016-10-13 14:54:31 +0000
commit1d4b163fc0fadab7ffe87149f3d1c897ded184f9 (patch)
treee748d3f5d998378ef704eaea0ea3667143f70a94 /llvm/lib/Transforms/Vectorize
parent8295d54868a6b8a60a68e81b4c4a92d2803f0d0c (diff)
downloadbcm5719-llvm-1d4b163fc0fadab7ffe87149f3d1c897ded184f9.tar.gz
bcm5719-llvm-1d4b163fc0fadab7ffe87149f3d1c897ded184f9.zip
[LV] Account for predicated stores in instruction costs
This patch ensures that we scale the estimated cost of predicated stores by block probability. This is a follow-on patch for r284123. llvm-svn: 284126
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index e41f414ef3c..ab5dc930a32 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6700,6 +6700,12 @@ unsigned LoopVectorizationCostModel::getInstructionCost(Instruction *I,
// we might create due to scalarization.
Cost += getScalarizationOverhead(I, VF, TTI);
+ // If we have a predicated store, it may not be executed for each vector
+ // lane. Scale the cost by the probability of executing the predicated
+ // block.
+ if (Legal->isScalarWithPredication(I))
+ Cost /= getReciprocalPredBlockProb();
+
return Cost;
}
OpenPOWER on IntegriCloud