[llvm] Add a pass to collect dropped variable statistics (PR #102233)

Shubham Sandeep Rastogi via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 10:35:09 PDT 2024


================
@@ -2514,6 +2521,181 @@ void PrintCrashIRInstrumentation::registerCallbacks(
       });
 }
 
+void DroppedVariableStats::registerCallbacks(
+    PassInstrumentationCallbacks &PIC) {
+  if (!DroppedVarStats)
+    return;
+
+  PIC.registerBeforeNonSkippedPassCallback(
+      [this](StringRef P, Any IR) { return this->runBeforePass(P, IR); });
+  PIC.registerAfterPassCallback(
+      [this](StringRef P, Any IR, const PreservedAnalyses &PA) {
+        return this->runAfterPass(P, IR, PA);
+      });
+  PIC.registerAfterPassInvalidatedCallback(
+      [this](StringRef P, const PreservedAnalyses &PA) {
+        return this->runAfterPassInvalidated(P, PA);
+      });
+}
+
+void DroppedVariableStats::runBeforePass(StringRef PassID, Any IR) {
+  DebugVariablesStack.push_back(
+      {DenseMap<const Function *, DenseSet<VarID>>(),
----------------
rastogishubham wrote:

No that does not work

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


More information about the llvm-commits mailing list