Browse Source

LoopVectorizationCostModel::selectInterleaveCount - assert we have a non-zero loop cost. NFCI.

The input LoopCost value can be zero, but if so it should be recalculated with the current VF. After that it should always be non-zero.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361387 91177308-0d34-0410-b5e6-96231b3b80d8
Simon Pilgrim 6 years ago
parent
commit
79e92fbf63
1 changed files with 2 additions and 0 deletions
  1. 2 0
      lib/Transforms/Vectorize/LoopVectorize.cpp

+ 2 - 0
lib/Transforms/Vectorize/LoopVectorize.cpp

@@ -5001,6 +5001,8 @@ unsigned LoopVectorizationCostModel::selectInterleaveCount(bool OptForSize,
   if (LoopCost == 0)
   if (LoopCost == 0)
     LoopCost = expectedCost(VF).first;
     LoopCost = expectedCost(VF).first;
 
 
+  assert(LoopCost && "Non-zero loop cost expected");
+
   // Clamp the calculated IC to be between the 1 and the max interleave count
   // Clamp the calculated IC to be between the 1 and the max interleave count
   // that the target allows.
   // that the target allows.
   if (IC > MaxInterleaveCount)
   if (IC > MaxInterleaveCount)