[PATCH] D18126: Port InstrProfiling pass to new pass manager

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 13:15:04 PDT 2016


chandlerc added inline comments.

================
Comment at: lib/Transforms/Instrumentation/InstrProfiling.cpp:34-38
@@ -33,14 +33,7 @@
 
-class InstrProfiling : public ModulePass {
+class InstrProfiling {
 public:
-  static char ID;
-
-  InstrProfiling() : ModulePass(ID) {}
-
-  InstrProfiling(const InstrProfOptions &Options)
-      : ModulePass(ID), Options(Options) {}
-
-  const char *getPassName() const override {
-    return "Frontend instrumentation-based coverage lowering";
-  }
+  InstrProfiling() {}
+  InstrProfiling(const InstrProfOptions &Options) : Options(Options) {}
 
+  bool run(Module &M);
----------------
If you want to create a per-run class that holds the state for each run, that's fine, but I think it would be better done as a separate change.

With the legacy pass manager the state for a single run is already kept inside the pass object and cleared between runs. My suggestion is to start off without changing that design, and if there is a desire to change it, do so as a follow-up change because they are two orthogonal aspects of the design.


http://reviews.llvm.org/D18126





More information about the llvm-commits mailing list