[llvm] 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
Fri Sep 1 16:46:10 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:

Could we omit `this` when possible? (ditto for other similar occurrences in this file)

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


More information about the llvm-commits mailing list