[llvm] [AMDGPU][NewPM] Port SIOptimizeVGPRLiveRange pass to NPM. (PR #117686)
Akshat Oke via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 26 00:58:34 PST 2024
================
@@ -611,35 +620,62 @@ void SIOptimizeVGPRLiveRange::optimizeWaterfallLiveRange(
}
}
-char SIOptimizeVGPRLiveRange::ID = 0;
+char SIOptimizeVGPRLiveRangeLegacy::ID = 0;
-INITIALIZE_PASS_BEGIN(SIOptimizeVGPRLiveRange, DEBUG_TYPE,
+INITIALIZE_PASS_BEGIN(SIOptimizeVGPRLiveRangeLegacy, DEBUG_TYPE,
"SI Optimize VGPR LiveRange", false, false)
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
INITIALIZE_PASS_DEPENDENCY(MachineLoopInfoWrapperPass)
INITIALIZE_PASS_DEPENDENCY(LiveVariablesWrapperPass)
-INITIALIZE_PASS_END(SIOptimizeVGPRLiveRange, DEBUG_TYPE,
+INITIALIZE_PASS_END(SIOptimizeVGPRLiveRangeLegacy, DEBUG_TYPE,
"SI Optimize VGPR LiveRange", false, false)
-char &llvm::SIOptimizeVGPRLiveRangeID = SIOptimizeVGPRLiveRange::ID;
+char &llvm::SIOptimizeVGPRLiveRangeLegacyID = SIOptimizeVGPRLiveRangeLegacy::ID;
+
+FunctionPass *llvm::createSIOptimizeVGPRLiveRangeLegacyPass() {
+ return new SIOptimizeVGPRLiveRangeLegacy();
+}
+
+bool SIOptimizeVGPRLiveRangeLegacy::runOnMachineFunction(MachineFunction &MF) {
+ if (skipFunction(MF.getFunction()))
+ return false;
-FunctionPass *llvm::createSIOptimizeVGPRLiveRangePass() {
- return new SIOptimizeVGPRLiveRange();
+ LiveVariables *LV = &getAnalysis<LiveVariablesWrapperPass>().getLV();
+ MachineDominatorTree *MDT =
+ &getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
+ MachineLoopInfo *Loops = &getAnalysis<MachineLoopInfoWrapperPass>().getLI();
+ return SIOptimizeVGPRLiveRange(LV, MDT, Loops).run(MF);
}
-bool SIOptimizeVGPRLiveRange::runOnMachineFunction(MachineFunction &MF) {
+PreservedAnalyses
+SIOptimizeVGPRLiveRangePass::run(MachineFunction &MF,
+ MachineFunctionAnalysisManager &MFAM) {
+ MFPropsModifier _(*this, MF);
+
+ if (MF.getFunction().hasOptNone())
+ return PreservedAnalyses::all();
+
----------------
optimisan wrote:
This is no longer required as OptNoneInstrumentation checks for it now.
https://github.com/llvm/llvm-project/blob/e914d97327ce5887e51c2d650987f2f48eda85c1/llvm/lib/Passes/StandardInstrumentations.cpp#L1050-L1060
https://github.com/llvm/llvm-project/pull/117686
More information about the llvm-commits
mailing list