[llvm] db49a78 - [SLP] Add a clarifying assert in block scheduling [NFC]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 28 11:09:04 PST 2022


Author: Philip Reames
Date: 2022-01-28T11:08:59-08:00
New Revision: db49a78900f5e4b59714565876b5dbb5e2dfe840

URL: https://github.com/llvm/llvm-project/commit/db49a78900f5e4b59714565876b5dbb5e2dfe840
DIFF: https://github.com/llvm/llvm-project/commit/db49a78900f5e4b59714565876b5dbb5e2dfe840.diff

LOG: [SLP] Add a clarifying assert in block scheduling [NFC]

The fact we could have a block with a valid scheduling window, but nothing to schedule was surprising to me.  After digging through the code, this can only happen if we don't find anything to directly vectorize.  However, the reduction handling code relies on this mode, so we can't simply consider such trees unvectorizeable.  The assert conveys both that this situation can happen, but also that it can *only* happen for an immediate gather.

Context: We built the bundle before deciding that vectorization of a bundle is possible.  A side effect of bundle construction is manipulating the scheduling window, so a bundle which isn't vectorizable can cause the creation or expansion of a scheduling window.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 967e527b16d5..84d00d50e7bc 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -7668,6 +7668,11 @@ void BoUpSLP::scheduleBlock(BlockScheduling *BS) {
   }
   BS->initialFillReadyList(ReadyInsts);
 
+  assert((!ReadyInsts.empty() ||
+          (VectorizableTree.size() == 1 &&
+           VectorizableTree[0]->State == TreeEntry::NeedToGather)) &&
+         "why no ready insts from scheduleable tree?");
+
   Instruction *LastScheduledInst = BS->ScheduleEnd;
 
   // Do the "real" scheduling.


        


More information about the llvm-commits mailing list