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

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 16:09:10 PDT 2024


================
@@ -559,6 +559,35 @@ class DotCfgChangeReporter : public ChangeReporter<IRDataT<DCData>> {
   std::unique_ptr<raw_fd_ostream> HTML;
 };
 
+class DroppedVariableStats {
+public:
+  DroppedVariableStats() {
+    llvm::outs() << "Pass Level, Pass Name, Num of Dropped Variables, Func or "
+                    "Module Name\n";
+  };
+  // We intend this to be unique per-compilation, thus no copies.
+  DroppedVariableStats(const DroppedVariableStats &) = delete;
+  void operator=(const DroppedVariableStats &) = delete;
+
+  void registerCallbacks(PassInstrumentationCallbacks &PIC);
+
+private:
+  using VarID =
+      std::tuple<const DILocalScope *, llvm::StringRef, unsigned, unsigned>;
----------------
adrian-prantl wrote:

Also, maybe this should be a struct.

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


More information about the llvm-commits mailing list