Skip to content

Commit

Permalink
[SLP] Add a clarifying assert in block scheduling [NFC]
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
preames committed Jan 28, 2022
1 parent 2771233 commit db49a78
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Expand Up @@ -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.
Expand Down

0 comments on commit db49a78

Please sign in to comment.