@@ -122,6 +122,8 @@ MemDGNodeIntervalBuilder::getBotMemDGNode(const Interval<Instruction> &Intvl,
122
122
Interval<MemDGNode>
123
123
MemDGNodeIntervalBuilder::make (const Interval<Instruction> &Instrs,
124
124
DependencyGraph &DAG) {
125
+ if (Instrs.empty ())
126
+ return {};
125
127
auto *TopMemN = getTopMemDGNode (Instrs, DAG);
126
128
// If we couldn't find a mem node in range TopN - BotN then it's empty.
127
129
if (TopMemN == nullptr )
@@ -529,8 +531,8 @@ Interval<Instruction> DependencyGraph::extend(ArrayRef<Instruction *> Instrs) {
529
531
}
530
532
}
531
533
};
532
- if (DAGInterval. empty ()) {
533
- assert (NewInterval == InstrsInterval && " Expected empty DAGInterval! " );
534
+ auto MemDAGInterval = MemDGNodeIntervalBuilder::make (DAGInterval, * this );
535
+ if (MemDAGInterval. empty ()) {
534
536
FullScan (NewInterval);
535
537
}
536
538
// 2. The new section is below the old section.
@@ -550,8 +552,7 @@ Interval<Instruction> DependencyGraph::extend(ArrayRef<Instruction *> Instrs) {
550
552
// range including both NewInterval and DAGInterval until DstN, for each DstN.
551
553
else if (DAGInterval.bottom ()->comesBefore (NewInterval.top ())) {
552
554
auto DstRange = MemDGNodeIntervalBuilder::make (NewInterval, *this );
553
- auto SrcRangeFull = MemDGNodeIntervalBuilder::make (
554
- DAGInterval.getUnionInterval (NewInterval), *this );
555
+ auto SrcRangeFull = MemDAGInterval.getUnionInterval (DstRange);
555
556
for (MemDGNode &DstN : DstRange) {
556
557
auto SrcRange =
557
558
Interval<MemDGNode>(SrcRangeFull.top (), DstN.getPrevNode ());
@@ -589,7 +590,7 @@ Interval<Instruction> DependencyGraph::extend(ArrayRef<Instruction *> Instrs) {
589
590
// When scanning for deps with destination in DAGInterval we need to
590
591
// consider sources from the NewInterval only, because all intra-DAGInterval
591
592
// dependencies have already been created.
592
- auto DstRangeOld = MemDGNodeIntervalBuilder::make (DAGInterval, * this ) ;
593
+ auto DstRangeOld = MemDAGInterval ;
593
594
auto SrcRange = MemDGNodeIntervalBuilder::make (NewInterval, *this );
594
595
for (MemDGNode &DstN : DstRangeOld)
595
596
scanAndAddDeps (DstN, SrcRange);
0 commit comments