@@ -1466,13 +1466,16 @@ static G4_INST* minElt(const std::vector<preEdge>& Elts)
1466
1466
void BB_Scheduler::relocatePseudoKills ()
1467
1467
{
1468
1468
// Reset local id after scheduling and build the location map.
1469
- std::unordered_map<G4_INST*, G4_INST*> LocMap;
1469
+ // Multiple pseudo-kills may be placed before a single instruction.
1470
+ std::unordered_map<G4_INST*, std::vector<G4_INST *>> LocMap;
1470
1471
int i = 0 ;
1471
1472
for (auto Inst : schedule) { Inst->setLocalId (i++); }
1472
1473
for (auto N : ddd.getNodes ()) {
1473
1474
G4_INST* Inst = N->getInst ();
1474
- if (Inst && Inst->isPseudoKill ())
1475
- LocMap[minElt (N->Succs )] = Inst;
1475
+ if (Inst && Inst->isPseudoKill ()) {
1476
+ G4_INST* Pos = minElt (N->Succs );
1477
+ LocMap[Pos].push_back (Inst);
1478
+ }
1476
1479
}
1477
1480
1478
1481
// Do nothing if there is no pseudo-kills.
@@ -1488,7 +1491,7 @@ void BB_Scheduler::relocatePseudoKills()
1488
1491
continue ;
1489
1492
auto I = LocMap.find (Inst);
1490
1493
if (I != LocMap.end ())
1491
- relocated.push_back ( I->second );
1494
+ relocated.insert (relocated. end (), I->second . begin (), I-> second . end () );
1492
1495
relocated.push_back (Inst);
1493
1496
}
1494
1497
std::swap (schedule, relocated);
@@ -1557,7 +1560,7 @@ bool BB_Scheduler::commitIfBeneficial(unsigned& MaxRPE, bool IsTopDown)
1557
1560
return true ;
1558
1561
}
1559
1562
} else if (NewRPE < MaxRPE) {
1560
- SCHED_DUMP (std::cerr << " the reduced pressure is " << NewRPE - MaxRPE << " \n " );
1563
+ SCHED_DUMP (std::cerr << " the reduced pressure is " << MaxRPE - NewRPE << " \n " );
1561
1564
}
1562
1565
}
1563
1566
0 commit comments