[llvm] [NewPM] LiveIntervals: Check dependencies for invalidation (PR #123563)

Akshat Oke via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 03:24:17 PST 2025


================
@@ -127,6 +127,20 @@ LiveIntervalsWrapperPass::LiveIntervalsWrapperPass() : MachineFunctionPass(ID) {
 
 LiveIntervals::~LiveIntervals() { clear(); }
 
+bool LiveIntervals::invalidate(
+    MachineFunction &MF, const PreservedAnalyses &PA,
+    MachineFunctionAnalysisManager::Invalidator &Inv) {
+  auto PAC = PA.getChecker<LiveIntervalsAnalysis>();
+
+  if (!PAC.preserved() && !PAC.preservedSet<AllAnalysesOn<MachineFunction>>())
+    return true;
+
+  // LiveIntervals holds pointers to these results, so check for their
+  // invalidation.
+  return (Inv.invalidate<SlotIndexesAnalysis>(MF, PA) ||
+          Inv.invalidate<MachineDominatorTreeAnalysis>(MF, PA));
+}
----------------
optimisan wrote:

`invalidate()` actually means `isThisResultInvalid(IR, PA)`, so if `SlotIndexes` reports that it has been made invalid, this analysis should also be invalid. `SI` and `MDT` are good with the default `invalidate()` implementation since they don't depend on other analyses.

https://github.com/llvm/llvm-project/pull/123563


More information about the llvm-commits mailing list