@@ -8795,12 +8795,8 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
8795
8795
8796
8796
BlockScheduling &BS = *BSRef;
8797
8797
8798
- SmallVector<Value *> MainOpIsTheFirst(UniqueValues);
8799
- auto MainOpIter = find(MainOpIsTheFirst, S.getMainOp());
8800
- std::rotate(MainOpIsTheFirst.begin(), MainOpIter, std::next(MainOpIter));
8801
-
8802
8798
std::optional<ScheduleData *> Bundle =
8803
- BS.tryScheduleBundle(MainOpIsTheFirst , this, S);
8799
+ BS.tryScheduleBundle(UniqueValues , this, S);
8804
8800
#ifdef EXPENSIVE_CHECKS
8805
8801
// Make sure we didn't break any internal invariants
8806
8802
BS.verify();
@@ -17467,7 +17463,6 @@ BoUpSLP::BlockScheduling::buildBundle(ArrayRef<Value *> VL) {
17467
17463
std::optional<BoUpSLP::ScheduleData *>
17468
17464
BoUpSLP::BlockScheduling::tryScheduleBundle(ArrayRef<Value *> VL, BoUpSLP *SLP,
17469
17465
const InstructionsState &S) {
17470
- assert(VL[0] == S.getMainOp() && "MainOp must be the first element of VL.");
17471
17466
// No need to schedule PHIs, insertelement, extractelement and extractvalue
17472
17467
// instructions.
17473
17468
if (isa<PHINode>(S.getMainOp()) ||
@@ -17557,21 +17552,21 @@ BoUpSLP::BlockScheduling::tryScheduleBundle(ArrayRef<Value *> VL, BoUpSLP *SLP,
17557
17552
auto *Bundle = buildBundle(VL);
17558
17553
TryScheduleBundleImpl(ReSchedule, Bundle);
17559
17554
if (!Bundle->isReady()) {
17560
- cancelScheduling(VL, S.getMainOp() );
17555
+ cancelScheduling(VL, Bundle->Inst );
17561
17556
return std::nullopt;
17562
17557
}
17563
17558
return Bundle;
17564
17559
}
17565
17560
17566
17561
void BoUpSLP::BlockScheduling::cancelScheduling(ArrayRef<Value *> VL,
17567
- Value *OpValue ) {
17568
- if (isa<PHINode>(OpValue ) || isVectorLikeInstWithConstOps(OpValue ) ||
17562
+ Value *Inst ) {
17563
+ if (isa<PHINode>(Inst ) || isVectorLikeInstWithConstOps(Inst ) ||
17569
17564
doesNotNeedToSchedule(VL))
17570
17565
return;
17571
17566
17572
- if (doesNotNeedToBeScheduled(OpValue ))
17573
- OpValue = *find_if_not(VL, doesNotNeedToBeScheduled);
17574
- ScheduleData *Bundle = getScheduleData(OpValue );
17567
+ if (doesNotNeedToBeScheduled(Inst ))
17568
+ Inst = *find_if_not(VL, doesNotNeedToBeScheduled);
17569
+ ScheduleData *Bundle = getScheduleData(Inst );
17575
17570
LLVM_DEBUG(dbgs() << "SLP: cancel scheduling of " << *Bundle << "\n");
17576
17571
assert(!Bundle->IsScheduled &&
17577
17572
"Can't cancel bundle which is already scheduled");
0 commit comments