Quellcode durchsuchen

[LV] Tail-folding with runtime memory checks

The loop vectorizer was running in an assert when it tried to fold the tail and
had to emit runtime memory disambiguation checks.

Differential revision: https://reviews.llvm.org/D66803

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370707 91177308-0d34-0410-b5e6-96231b3b80d8
Sjoerd Meijer vor 6 Jahren
Ursprung
Commit
8103f963ba
1 geänderte Dateien mit 4 neuen und 1 gelöschten Zeilen
  1. 4 1
      lib/Transforms/Vectorize/LoopVectorize.cpp

+ 4 - 1
lib/Transforms/Vectorize/LoopVectorize.cpp

@@ -2697,6 +2697,7 @@ void InnerLoopVectorizer::emitSCEVChecks(Loop *L, BasicBlock *Bypass) {
 
   assert(!Cost->foldTailByMasking() &&
          "Cannot SCEV check stride or overflow when folding tail");
+
   // Create a new block containing the stride check.
   BB->setName("vector.scevcheck");
   auto *NewBB = BB->splitBasicBlock(BB->getTerminator(), "vector.ph");
@@ -2729,7 +2730,9 @@ void InnerLoopVectorizer::emitMemRuntimeChecks(Loop *L, BasicBlock *Bypass) {
   if (!MemRuntimeCheck)
     return;
 
-  assert(!Cost->foldTailByMasking() && "Cannot check memory when folding tail");
+  assert(!BB->getParent()->hasOptSize() &&
+         "Cannot emit memory checks when optimizing for size");
+
   // Create a new block containing the memory check.
   BB->setName("vector.memcheck");
   auto *NewBB = BB->splitBasicBlock(BB->getTerminator(), "vector.ph");