[llvm] 66dd7e6 - Simplify enablePostRAScheduler and test enablePostRAScheduler() early
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 28 23:51:50 PST 2024
Author: Fangrui Song
Date: 2024-12-28T23:51:44-08:00
New Revision: 66dd7e63d8a1860c11f3b9acf011cad4e18f0195
URL: https://github.com/llvm/llvm-project/commit/66dd7e63d8a1860c11f3b9acf011cad4e18f0195
DIFF: https://github.com/llvm/llvm-project/commit/66dd7e63d8a1860c11f3b9acf011cad4e18f0195.diff
LOG: Simplify enablePostRAScheduler and test enablePostRAScheduler() early
Added:
Modified:
llvm/lib/CodeGen/PostRASchedulerList.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/PostRASchedulerList.cpp b/llvm/lib/CodeGen/PostRASchedulerList.cpp
index 2f7cfdd275b4fd..badfd9a68d6a01 100644
--- a/llvm/lib/CodeGen/PostRASchedulerList.cpp
+++ b/llvm/lib/CodeGen/PostRASchedulerList.cpp
@@ -98,12 +98,6 @@ namespace {
}
bool runOnMachineFunction(MachineFunction &Fn) override;
-
- private:
- bool enablePostRAScheduler(
- const TargetSubtargetInfo &ST, CodeGenOptLevel OptLevel,
- TargetSubtargetInfo::AntiDepBreakMode &Mode,
- TargetSubtargetInfo::RegClassVector &CriticalPathRCs) const;
};
char PostRAScheduler::ID = 0;
@@ -259,13 +253,8 @@ LLVM_DUMP_METHOD void SchedulePostRATDList::dumpSchedule() const {
}
#endif
-bool PostRAScheduler::enablePostRAScheduler(
- const TargetSubtargetInfo &ST, CodeGenOptLevel OptLevel,
- TargetSubtargetInfo::AntiDepBreakMode &Mode,
- TargetSubtargetInfo::RegClassVector &CriticalPathRCs) const {
- Mode = ST.getAntiDepBreakMode();
- ST.getCriticalPathRCs(CriticalPathRCs);
-
+static bool enablePostRAScheduler(const TargetSubtargetInfo &ST,
+ CodeGenOptLevel OptLevel) {
// Check for explicit enable/disable of post-ra scheduling.
if (EnablePostRAScheduler.getPosition() > 0)
return EnablePostRAScheduler;
@@ -278,24 +267,17 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
if (skipFunction(Fn.getFunction()))
return false;
- TII = Fn.getSubtarget().getInstrInfo();
- MachineLoopInfo &MLI = getAnalysis<MachineLoopInfoWrapperPass>().getLI();
- AliasAnalysis *AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
+ const auto &Subtarget = Fn.getSubtarget();
TargetPassConfig *PassConfig = &getAnalysis<TargetPassConfig>();
-
- RegClassInfo.runOnMachineFunction(Fn);
-
- TargetSubtargetInfo::AntiDepBreakMode AntiDepMode =
- TargetSubtargetInfo::ANTIDEP_NONE;
- SmallVector<const TargetRegisterClass*, 4> CriticalPathRCs;
-
// Check that post-RA scheduling is enabled for this target.
- // This may upgrade the AntiDepMode.
- if (!enablePostRAScheduler(Fn.getSubtarget(), PassConfig->getOptLevel(),
- AntiDepMode, CriticalPathRCs))
+ if (!enablePostRAScheduler(Subtarget, PassConfig->getOptLevel()))
return false;
- // Check for antidep breaking override...
+ TII = Subtarget.getInstrInfo();
+ MachineLoopInfo &MLI = getAnalysis<MachineLoopInfoWrapperPass>().getLI();
+ AliasAnalysis *AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
+ TargetSubtargetInfo::AntiDepBreakMode AntiDepMode =
+ Subtarget.getAntiDepBreakMode();
if (EnableAntiDepBreaking.getPosition() > 0) {
AntiDepMode = (EnableAntiDepBreaking == "all")
? TargetSubtargetInfo::ANTIDEP_ALL
@@ -303,6 +285,9 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
? TargetSubtargetInfo::ANTIDEP_CRITICAL
: TargetSubtargetInfo::ANTIDEP_NONE);
}
+ SmallVector<const TargetRegisterClass *, 4> CriticalPathRCs;
+ Subtarget.getCriticalPathRCs(CriticalPathRCs);
+ RegClassInfo.runOnMachineFunction(Fn);
LLVM_DEBUG(dbgs() << "PostRAScheduler\n");
More information about the llvm-commits
mailing list