@@ -539,21 +539,30 @@ void SIScheduleBlock::addPred(SIScheduleBlock *Pred) {
539
539
Preds.push_back (Pred);
540
540
541
541
assert (none_of (Succs,
542
- [=](SIScheduleBlock *S) { return PredID == S->getID (); }) &&
542
+ [=](std::pair<SIScheduleBlock*,
543
+ SIScheduleBlockLinkKind> S) {
544
+ return PredID == S.first ->getID ();
545
+ }) &&
543
546
" Loop in the Block Graph!" );
544
547
}
545
548
546
- void SIScheduleBlock::addSucc (SIScheduleBlock *Succ) {
549
+ void SIScheduleBlock::addSucc (SIScheduleBlock *Succ,
550
+ SIScheduleBlockLinkKind Kind) {
547
551
unsigned SuccID = Succ->getID ();
548
552
549
553
// Check if not already predecessor.
550
- for (SIScheduleBlock* S : Succs) {
551
- if (SuccID == S->getID ())
554
+ for (std::pair<SIScheduleBlock*, SIScheduleBlockLinkKind> &S : Succs) {
555
+ if (SuccID == S.first ->getID ()) {
556
+ if (S.second == SIScheduleBlockLinkKind::NoData &&
557
+ Kind == SIScheduleBlockLinkKind::Data)
558
+ S.second = Kind;
552
559
return ;
560
+ }
553
561
}
554
562
if (Succ->isHighLatencyBlock ())
555
563
++NumHighLatencySuccessors;
556
- Succs.push_back (Succ);
564
+ Succs.push_back (std::make_pair (Succ, Kind));
565
+
557
566
assert (none_of (Preds,
558
567
[=](SIScheduleBlock *P) { return SuccID == P->getID (); }) &&
559
568
" Loop in the Block Graph!" );
@@ -573,8 +582,10 @@ void SIScheduleBlock::printDebug(bool full) {
573
582
}
574
583
575
584
dbgs () << " \n Successors:\n " ;
576
- for (SIScheduleBlock* S : Succs) {
577
- S->printDebug (false );
585
+ for (std::pair<SIScheduleBlock*, SIScheduleBlockLinkKind> S : Succs) {
586
+ if (S.second == SIScheduleBlockLinkKind::Data)
587
+ dbgs () << " (Data Dep) " ;
588
+ S.first ->printDebug (false );
578
589
}
579
590
580
591
if (Scheduled) {
@@ -1096,7 +1107,8 @@ void SIScheduleBlockCreator::createBlocksForVariant(SISchedulerBlockCreatorVaria
1096
1107
if (SuccDep.isWeak () || Succ->NodeNum >= DAGSize)
1097
1108
continue ;
1098
1109
if (Node2CurrentBlock[Succ->NodeNum ] != SUID)
1099
- CurrentBlocks[SUID]->addSucc (CurrentBlocks[Node2CurrentBlock[Succ->NodeNum ]]);
1110
+ CurrentBlocks[SUID]->addSucc (CurrentBlocks[Node2CurrentBlock[Succ->NodeNum ]],
1111
+ SuccDep.isCtrl () ? NoData : Data);
1100
1112
}
1101
1113
for (SDep& PredDep : SU->Preds ) {
1102
1114
SUnit *Pred = PredDep.getSUnit ();
@@ -1290,10 +1302,8 @@ void SIScheduleBlockCreator::fillStats() {
1290
1302
Block->Height = 0 ;
1291
1303
else {
1292
1304
unsigned Height = 0 ;
1293
- for (SIScheduleBlock *Succ : Block->getSuccs ()) {
1294
- if (Height < Succ->Height + 1 )
1295
- Height = Succ->Height + 1 ;
1296
- }
1305
+ for (const auto &Succ : Block->getSuccs ())
1306
+ Height = std::min (Height, Succ.first ->Height + 1 );
1297
1307
Block->Height = Height;
1298
1308
}
1299
1309
}
@@ -1574,17 +1584,13 @@ void SIScheduleBlockScheduler::decreaseLiveRegs(SIScheduleBlock *Block,
1574
1584
}
1575
1585
1576
1586
void SIScheduleBlockScheduler::releaseBlockSuccs (SIScheduleBlock *Parent) {
1577
- for (SIScheduleBlock* Block : Parent->getSuccs ()) {
1578
- --BlockNumPredsLeft[Block->getID ()];
1579
- if (BlockNumPredsLeft[Block->getID ()] == 0 ) {
1580
- ReadyBlocks.push_back (Block);
1581
- }
1582
- // TODO: Improve check. When the dependency between the high latency
1583
- // instructions and the instructions of the other blocks are WAR or WAW
1584
- // there will be no wait triggered. We would like these cases to not
1585
- // update LastPosHighLatencyParentScheduled.
1586
- if (Parent->isHighLatencyBlock ())
1587
- LastPosHighLatencyParentScheduled[Block->getID ()] = NumBlockScheduled;
1587
+ for (const auto &Block : Parent->getSuccs ()) {
1588
+ if (--BlockNumPredsLeft[Block.first ->getID ()] == 0 )
1589
+ ReadyBlocks.push_back (Block.first );
1590
+
1591
+ if (Parent->isHighLatencyBlock () &&
1592
+ Block.second == SIScheduleBlockLinkKind::Data)
1593
+ LastPosHighLatencyParentScheduled[Block.first ->getID ()] = NumBlockScheduled;
1588
1594
}
1589
1595
}
1590
1596
0 commit comments