[llvm] 6987ac7 - Revert "[SLP] Remove SchedulingPriority from ScheduleData [NFC]"
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 1 17:31:58 PST 2022
Author: Arthur Eubanks
Date: 2022-03-01T17:28:52-08:00
New Revision: 6987ac79033bb417c354b8fdb090d362d1dfe06e
URL: https://github.com/llvm/llvm-project/commit/6987ac79033bb417c354b8fdb090d362d1dfe06e
DIFF: https://github.com/llvm/llvm-project/commit/6987ac79033bb417c354b8fdb090d362d1dfe06e.diff
LOG: Revert "[SLP] Remove SchedulingPriority from ScheduleData [NFC]"
This reverts commit a3e9b32c00959ad5c73189d8378d019fbe80ade5.
Required for reverting D118538.
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index c614fd31a3b00..4bf6b4bef6aab 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -2624,6 +2624,9 @@ class BoUpSLP {
/// the current SchedulingRegionID of BlockScheduling.
int SchedulingRegionID = 0;
+ /// Used for getting a "good" final ordering of instructions.
+ int SchedulingPriority = 0;
+
/// The number of dependencies. Constitutes of the number of users of the
/// instruction plus the number of dependent memory instructions (if any).
/// This value is calculated on demand.
@@ -7982,23 +7985,23 @@ void BoUpSLP::scheduleBlock(BlockScheduling *BS) {
// For the real scheduling we use a more sophisticated ready-list: it is
// sorted by the original instruction location. This lets the final schedule
// be as close as possible to the original instruction order.
- DenseMap<ScheduleData *, unsigned> OriginalOrder;
- auto ScheduleDataCompare = [&](ScheduleData *SD1, ScheduleData *SD2) {
- return OriginalOrder[SD2] < OriginalOrder[SD1];
+ struct ScheduleDataCompare {
+ bool operator()(ScheduleData *SD1, ScheduleData *SD2) const {
+ return SD2->SchedulingPriority < SD1->SchedulingPriority;
+ }
};
- std::set<ScheduleData *, decltype(ScheduleDataCompare)>
- ReadyInsts(ScheduleDataCompare);
+ std::set<ScheduleData *, ScheduleDataCompare> ReadyInsts;
// Ensure that all dependency data is updated (for nodes in the sub-graph)
// and fill the ready-list with initial instructions.
int Idx = 0;
for (auto *I = BS->ScheduleStart; I != BS->ScheduleEnd;
I = I->getNextNode()) {
- BS->doForAllOpcodes(I, [&](ScheduleData *SD) {
+ BS->doForAllOpcodes(I, [this, &Idx, BS](ScheduleData *SD) {
assert((isVectorLikeInstWithConstOps(SD->Inst) ||
SD->isPartOfBundle() == (getTreeEntry(SD->Inst) != nullptr)) &&
"scheduler and vectorizer bundle mismatch");
- OriginalOrder[SD->FirstInBundle] = Idx++;
+ SD->FirstInBundle->SchedulingPriority = Idx++;
if (SD->isSchedulingEntity() && SD->isPartOfBundle())
BS->calculateDependencies(SD, false, this);
More information about the llvm-commits
mailing list