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

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 3 10:55:52 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); });
----------------
mshockwave wrote:

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

Hmmm alright, then leave it as it for now I guess

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


More information about the llvm-commits mailing list