summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-08-06 20:12:41 +0000
committerCraig Topper <craig.topper@intel.com>2019-08-06 20:12:41 +0000
commitfc33e33776b7a7ce22e539f0ec2e3bfdb09ad361 (patch)
tree2c385036ebedb130e4eae5ff34c0e4ca2879ac75 /llvm/lib/Transforms/Vectorize
parentb1e4da2b906a9d9d9a2f88343c859a27bb8b12f5 (diff)
downloadbcm5719-llvm-fc33e33776b7a7ce22e539f0ec2e3bfdb09ad361.tar.gz
bcm5719-llvm-fc33e33776b7a7ce22e539f0ec2e3bfdb09ad361.zip
[X86] Add more extract subvector cost model tests for smaller element sizes and smaller than 128-bit vectors.
With the switch to widening legalization, we need to a better job of costing extractions of less than 128-bits. llvm-svn: 368081
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index dd28b18258f..42371a5beb6 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5135,6 +5135,15 @@ unsigned LoopVectorizationCostModel::selectInterleaveCount(unsigned VF,
else if (IC < 1)
IC = 1;
+ // If the trip count is constant, clamp the calculated IC to be between 1 and
+ // the trip count divided by VF.
+ if (TC > 0) {
+ if ((TC / VF) < IC)
+ IC = (TC / VF);
+ if (IC < 1)
+ IC = 1;
+ }
+
// Interleave if we vectorized this loop and there is a reduction that could
// benefit from interleaving.
if (VF > 1 && !Legal->getReductionVars()->empty()) {
OpenPOWER on IntegriCloud