[llvm] [NewPM] Add `FunctionToMachineFunctionPassAdaptor` (PR #88711)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 09:35:11 PDT 2024


================
@@ -69,6 +71,29 @@ bool MachineFunctionAnalysisManagerModuleProxy::Result::invalidate(
   return false;
 }
 
+template <>
+bool MachineFunctionAnalysisManagerFunctionProxy::Result::invalidate(
+    Function &F, const PreservedAnalyses &PA,
+    FunctionAnalysisManager::Invalidator &Inv) {
+  // If literally everything is preserved, we're done.
+  if (PA.areAllPreserved())
+    return false; // This is still a valid proxy.
+
+  // If this proxy isn't marked as preserved, then even if the result remains
+  // valid, the key itself may no longer be valid, so we clear everything.
+  //
+  // Once function changed by a non-trivial pass, we need to do instruction
+  // selection again.
+  auto PAC = PA.getChecker<FunctionAnalysisManagerModuleProxy>();
----------------
arsenm wrote:

const &?

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


More information about the llvm-commits mailing list