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

Akshat Oke via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 04:04:28 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:

Yes, it is related here https://github.com/llvm/llvm-project/pull/123045#issuecomment-2592793893

New PM can't report such cases. Could add such a functionality behind a flag but I guess it's unlikely for more cases like this to exist, since they would lead to invalid reads (as the PM deletes the results).

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


More information about the llvm-commits mailing list