[SLP] Add assert that entities are scheduled as expected
authorPhilip Reames <listmail@philipreames.com>
Tue, 15 Feb 2022 20:20:33 +0000 (12:20 -0800)
committerPhilip Reames <listmail@philipreames.com>
Tue, 15 Feb 2022 20:21:49 +0000 (12:21 -0800)
Requested in D118538

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

index d29440a..ca1922e 100644 (file)
@@ -7952,6 +7952,17 @@ void BoUpSLP::scheduleBlock(BlockScheduling *BS) {
   BS->verify();
 #endif
 
+#ifndef NDEBUG
+  // Check that all schedulable entities got scheduled
+  for (auto *I = BS->ScheduleStart; I != BS->ScheduleEnd; I = I->getNextNode()) {
+    BS->doForAllOpcodes(I, [&](ScheduleData *SD) {
+      if (SD->isSchedulingEntity() && SD->hasValidDependencies()) {
+        assert(SD->IsScheduled && "must be scheduled at this point");
+      }
+    });
+  }
+#endif
+
   // Avoid duplicate scheduling of the block.
   BS->ScheduleStart = nullptr;
 }