[PATCH] D15776: Filtering IR printing for print-after-all/print-before-all

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 5 12:48:57 PST 2016


joker.eph added inline comments.

================
Comment at: lib/Analysis/LoopPass.cpp:45-47
@@ -44,3 +44,5 @@
   bool runOnLoop(Loop *L, LPPassManager &) override {
-    P.run(*L);
+    if (L->getHeader() &&
+        isFunctionInPrintList(L->getHeader()->getParent()->getName()))
+      P.run(*L);
     return false;
----------------
Not clear to me: either there is a valid use case where `PrintLoopPassWrapper::runOnLoop()` is called with `getHeader()` returning null or not, can you clarify?

In the absence of such valid case, please turn this into an assert or just remove the check.

================
Comment at: lib/IR/LegacyPassManager.cpp:126
@@ +125,3 @@
+      PrintFuncNames.insert("*");
+  }
+
----------------
Is it possible to write it:

```
static std::set<std::string> PrintFuncNames(PrintFuncsList.begin(), PrintFuncsList.end());
```

?

Also, why not an `unordered_set`?

================
Comment at: lib/IR/LegacyPassManager.cpp:129
@@ +128,3 @@
+  if (PrintFuncNames.count("*"))
+    return true;
+  return PrintFuncNames.count(FunctionName);
----------------
I'm not sure I see the need for the "*" in the set? The empty case returning true seems enough to me to provide exactly the same behavior.


Repository:
  rL LLVM

http://reviews.llvm.org/D15776





More information about the llvm-commits mailing list