[llvm] Add flags to dump IR to a file before and after LLVM passes (PR #65179)

Nuri Amari via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 2 18:17:56 PDT 2023


================
@@ -830,6 +831,182 @@ void PrintIRInstrumentation::registerCallbacks(
   }
 }
 
+void DumpIRInstrumentation::registerCallbacks(
+    PassInstrumentationCallbacks &PIC) {
+
+  if (!(shouldDumpBeforeSomePass() || shouldDumpAfterSomePass()))
+    return;
+
+  this->PIC = &PIC;
+
+  PIC.registerBeforeNonSkippedPassCallback(
+      [this](StringRef P, Any IR) { this->pushPass(P, IR); });
----------------
NuriAmari wrote:

I don't yet understand why, but `this` is not implicitly captured here, it fails to compile without an explicit capture.

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


More information about the llvm-commits mailing list