@@ -2563,9 +2563,6 @@ class BoUpSLP {
2563
2563
// / the current SchedulingRegionID of BlockScheduling.
2564
2564
int SchedulingRegionID = 0 ;
2565
2565
2566
- // / Used for getting a "good" final ordering of instructions.
2567
- int SchedulingPriority = 0 ;
2568
-
2569
2566
// / The number of dependencies. Constitutes of the number of users of the
2570
2567
// / instruction plus the number of dependent memory instructions (if any).
2571
2568
// / This value is calculated on demand.
@@ -7828,23 +7825,23 @@ void BoUpSLP::scheduleBlock(BlockScheduling *BS) {
7828
7825
// For the real scheduling we use a more sophisticated ready-list: it is
7829
7826
// sorted by the original instruction location. This lets the final schedule
7830
7827
// be as close as possible to the original instruction order.
7831
- struct ScheduleDataCompare {
7832
- bool operator ()(ScheduleData *SD1, ScheduleData *SD2) const {
7833
- return SD2->SchedulingPriority < SD1->SchedulingPriority ;
7834
- }
7828
+ DenseMap<ScheduleData *, unsigned > OriginalOrder;
7829
+ auto ScheduleDataCompare = [&](ScheduleData *SD1, ScheduleData *SD2) {
7830
+ return OriginalOrder[SD2] < OriginalOrder[SD1];
7835
7831
};
7836
- std::set<ScheduleData *, ScheduleDataCompare> ReadyInsts;
7832
+ std::set<ScheduleData *, decltype (ScheduleDataCompare)>
7833
+ ReadyInsts (ScheduleDataCompare);
7837
7834
7838
7835
// Ensure that all dependency data is updated (for nodes in the sub-graph)
7839
7836
// and fill the ready-list with initial instructions.
7840
7837
int Idx = 0 ;
7841
7838
for (auto *I = BS->ScheduleStart ; I != BS->ScheduleEnd ;
7842
7839
I = I->getNextNode ()) {
7843
- BS->doForAllOpcodes (I, [this , &Idx, BS ](ScheduleData *SD) {
7840
+ BS->doForAllOpcodes (I, [& ](ScheduleData *SD) {
7844
7841
assert ((isVectorLikeInstWithConstOps (SD->Inst ) ||
7845
7842
SD->isPartOfBundle () == (getTreeEntry (SD->Inst ) != nullptr )) &&
7846
7843
" scheduler and vectorizer bundle mismatch" );
7847
- SD->FirstInBundle -> SchedulingPriority = Idx++;
7844
+ OriginalOrder[ SD->FirstInBundle ] = Idx++;
7848
7845
7849
7846
if (SD->isSchedulingEntity () && SD->isPartOfBundle ())
7850
7847
BS->calculateDependencies (SD, false , this );
0 commit comments