[llvm] AMDGPU: Use LiveIntervals instead of LiveVariables in SIOptimizeVGPRLiveRange (PR #227252)
Christudasan Devadasan via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 21:52:25 PDT 2026
================
@@ -686,33 +512,28 @@ bool SIOptimizeVGPRLiveRangeLegacy::runOnMachineFunction(MachineFunction &MF) {
if (skipFunction(MF.getFunction()))
return false;
- auto *LISWrapper = getAnalysisIfAvailable<LiveIntervalsWrapperPass>();
- LiveIntervals *LIS = LISWrapper ? &LISWrapper->getLIS() : nullptr;
- LiveVariables *LV = &getAnalysis<LiveVariablesWrapperPass>().getLV();
+ LiveIntervals *LIS = &getAnalysis<LiveIntervalsWrapperPass>().getLIS();
MachineDominatorTree *MDT =
&getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
MachineLoopInfo *Loops = &getAnalysis<MachineLoopInfoWrapperPass>().getLI();
- return SIOptimizeVGPRLiveRange(LIS, LV, MDT, Loops).run(MF);
+ return SIOptimizeVGPRLiveRange(LIS, MDT, Loops).run(MF);
}
PreservedAnalyses
SIOptimizeVGPRLiveRangePass::run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM) {
MFPropsModifier _(*this, MF);
- LiveIntervals *LIS = MFAM.getCachedResult<LiveIntervalsAnalysis>(MF);
- LiveVariables *LV = MFAM.getCachedResult<LiveVariablesAnalysis>(MF);
- if (!LIS && !LV)
- LV = &MFAM.getResult<LiveVariablesAnalysis>(MF);
+ LiveIntervals *LIS = &MFAM.getResult<LiveIntervalsAnalysis>(MF);
MachineDominatorTree *MDT = &MFAM.getResult<MachineDominatorTreeAnalysis>(MF);
MachineLoopInfo *Loops = &MFAM.getResult<MachineLoopAnalysis>(MF);
- bool Changed = SIOptimizeVGPRLiveRange(LIS, LV, MDT, Loops).run(MF);
+ bool Changed = SIOptimizeVGPRLiveRange(LIS, MDT, Loops).run(MF);
if (!Changed)
return PreservedAnalyses::all();
auto PA = getMachineFunctionPassPreservedAnalyses();
+ PA.preserve<SlotIndexesAnalysis>();
----------------
cdevadas wrote:
I was expecting the pass manager to resolve such dependencies. They are statically known anyway.
https://github.com/llvm/llvm-project/pull/227252
More information about the llvm-commits
mailing list