Skip to content

Commit a3e9b32

Browse files
committed
[SLP] Remove SchedulingPriority from ScheduleData [NFC]
First step in trying to shrink the memory footprint of ScheduleData to improve cache locality.
1 parent 78f7a6f commit a3e9b32

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2563,9 +2563,6 @@ class BoUpSLP {
25632563
/// the current SchedulingRegionID of BlockScheduling.
25642564
int SchedulingRegionID = 0;
25652565

2566-
/// Used for getting a "good" final ordering of instructions.
2567-
int SchedulingPriority = 0;
2568-
25692566
/// The number of dependencies. Constitutes of the number of users of the
25702567
/// instruction plus the number of dependent memory instructions (if any).
25712568
/// This value is calculated on demand.
@@ -7828,23 +7825,23 @@ void BoUpSLP::scheduleBlock(BlockScheduling *BS) {
78287825
// For the real scheduling we use a more sophisticated ready-list: it is
78297826
// sorted by the original instruction location. This lets the final schedule
78307827
// 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];
78357831
};
7836-
std::set<ScheduleData *, ScheduleDataCompare> ReadyInsts;
7832+
std::set<ScheduleData *, decltype(ScheduleDataCompare)>
7833+
ReadyInsts(ScheduleDataCompare);
78377834

78387835
// Ensure that all dependency data is updated (for nodes in the sub-graph)
78397836
// and fill the ready-list with initial instructions.
78407837
int Idx = 0;
78417838
for (auto *I = BS->ScheduleStart; I != BS->ScheduleEnd;
78427839
I = I->getNextNode()) {
7843-
BS->doForAllOpcodes(I, [this, &Idx, BS](ScheduleData *SD) {
7840+
BS->doForAllOpcodes(I, [&](ScheduleData *SD) {
78447841
assert((isVectorLikeInstWithConstOps(SD->Inst) ||
78457842
SD->isPartOfBundle() == (getTreeEntry(SD->Inst) != nullptr)) &&
78467843
"scheduler and vectorizer bundle mismatch");
7847-
SD->FirstInBundle->SchedulingPriority = Idx++;
7844+
OriginalOrder[SD->FirstInBundle] = Idx++;
78487845

78497846
if (SD->isSchedulingEntity() && SD->isPartOfBundle())
78507847
BS->calculateDependencies(SD, false, this);

0 commit comments

Comments
 (0)