[llvm] a3e9b32 - [SLP] Remove SchedulingPriority from ScheduleData [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 23 11:43:52 PST 2022
Author: Philip Reames
Date: 2022-02-23T11:43:46-08:00
New Revision: a3e9b32c00959ad5c73189d8378d019fbe80ade5
URL: https://github.com/llvm/llvm-project/commit/a3e9b32c00959ad5c73189d8378d019fbe80ade5
DIFF: https://github.com/llvm/llvm-project/commit/a3e9b32c00959ad5c73189d8378d019fbe80ade5.diff
LOG: [SLP] Remove SchedulingPriority from ScheduleData [NFC]
First step in trying to shrink the memory footprint of ScheduleData to improve cache locality.
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 9b38be00d7e13..96ab621e89f1d 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -2563,9 +2563,6 @@ 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.
@@ -7828,23 +7825,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.
- struct ScheduleDataCompare {
- bool operator()(ScheduleData *SD1, ScheduleData *SD2) const {
- return SD2->SchedulingPriority < SD1->SchedulingPriority;
- }
+ DenseMap<ScheduleData *, unsigned> OriginalOrder;
+ auto ScheduleDataCompare = [&](ScheduleData *SD1, ScheduleData *SD2) {
+ return OriginalOrder[SD2] < OriginalOrder[SD1];
};
- std::set<ScheduleData *, ScheduleDataCompare> ReadyInsts;
+ std::set<ScheduleData *, decltype(ScheduleDataCompare)>
+ ReadyInsts(ScheduleDataCompare);
// 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, [this, &Idx, BS](ScheduleData *SD) {
+ BS->doForAllOpcodes(I, [&](ScheduleData *SD) {
assert((isVectorLikeInstWithConstOps(SD->Inst) ||
SD->isPartOfBundle() == (getTreeEntry(SD->Inst) != nullptr)) &&
"scheduler and vectorizer bundle mismatch");
- SD->FirstInBundle->SchedulingPriority = Idx++;
+ OriginalOrder[SD->FirstInBundle] = Idx++;
if (SD->isSchedulingEntity() && SD->isPartOfBundle())
BS->calculateDependencies(SD, false, this);
More information about the llvm-commits
mailing list