[llvm] [NewPM][CodeGen] Add callback style codegen pass builder (PR #108690)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 01:06:45 PDT 2024


================
@@ -145,6 +145,17 @@ PreservedAnalyses ModuleToFunctionPassAdaptor::run(Module &M,
   return PA;
 }
 
+void ModuleToFunctionPassAdaptor::eraseIf(function_ref<bool(StringRef)> Pred) {
+  StringRef PassName = Pass->name();
+  if (PassName.contains("PassManager") || PassName.ends_with("PassAdaptor")) {
+    Pass->eraseIf(Pred);
+    if (Pass->isEmpty())
+      Pass.reset();
+  } else if (Pred(PassName)) {
+    Pass.reset();
+  }
+}
----------------
arsenm wrote:

I don't understand why this is necessary, it feels clumsy 

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


More information about the llvm-commits mailing list