[llvm] d9756fa - [slp] Factor out a lambda to avoid uplicating code a third time in upcoming patch [nfc]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 25 09:02:50 PDT 2022
Author: Philip Reames
Date: 2022-03-25T09:02:39-07:00
New Revision: d9756fa723be7907afdceb933644a2dc00d6e5af
URL: https://github.com/llvm/llvm-project/commit/d9756fa723be7907afdceb933644a2dc00d6e5af
DIFF: https://github.com/llvm/llvm-project/commit/d9756fa723be7907afdceb933644a2dc00d6e5af.diff
LOG: [slp] Factor out a lambda to avoid uplicating code a third time in upcoming patch [nfc]
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 5bcb2ee54f9be..e8daa02958ae1 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -8069,6 +8069,18 @@ void BoUpSLP::BlockScheduling::calculateDependencies(ScheduleData *SD,
}
}
+ auto makeControlDependent = [&](Instruction *I) {
+ auto *DepDest = getScheduleData(I);
+ assert(DepDest && "must be in schedule window");
+ DepDest->ControlDependencies.push_back(BundleMember);
+ BundleMember->Dependencies++;
+ ScheduleData *DestBundle = DepDest->FirstInBundle;
+ if (!DestBundle->IsScheduled)
+ BundleMember->incrementUnscheduledDeps(1);
+ if (!DestBundle->hasValidDependencies())
+ WorkList.push_back(DestBundle);
+ };
+
// Any instruction which isn't safe to speculate at the begining of the
// block is control dependend on any early exit or non-willreturn call
// which proceeds it.
@@ -8079,15 +8091,7 @@ void BoUpSLP::BlockScheduling::calculateDependencies(ScheduleData *SD,
continue;
// Add the dependency
- auto *DepDest = getScheduleData(I);
- assert(DepDest && "must be in schedule window");
- DepDest->ControlDependencies.push_back(BundleMember);
- BundleMember->Dependencies++;
- ScheduleData *DestBundle = DepDest->FirstInBundle;
- if (!DestBundle->IsScheduled)
- BundleMember->incrementUnscheduledDeps(1);
- if (!DestBundle->hasValidDependencies())
- WorkList.push_back(DestBundle);
+ makeControlDependent(I);
if (!isGuaranteedToTransferExecutionToSuccessor(I))
// Everything past here must be control dependent on I.
@@ -8109,15 +8113,7 @@ void BoUpSLP::BlockScheduling::calculateDependencies(ScheduleData *SD,
continue;
// Add the dependency
- auto *DepDest = getScheduleData(I);
- assert(DepDest && "must be in schedule window");
- DepDest->ControlDependencies.push_back(BundleMember);
- BundleMember->Dependencies++;
- ScheduleData *DestBundle = DepDest->FirstInBundle;
- if (!DestBundle->IsScheduled)
- BundleMember->incrementUnscheduledDeps(1);
- if (!DestBundle->hasValidDependencies())
- WorkList.push_back(DestBundle);
+ makeControlDependent(I);
}
}
More information about the llvm-commits
mailing list