Filtering IR printing for print-after-all/print-before-all
[oota-llvm.git] / lib / Analysis / LoopPass.cpp
index dc424734dd5661dcc8f1fccd3c88afb7017198a8..e24a9e46fc1577a3a6104ff2818dbcc226937c4c 100644 (file)
@@ -42,7 +42,11 @@ public:
   }
 
   bool runOnLoop(Loop *L, LPPassManager &) override {
-    P.run(*L);
+    auto BBI = find_if(L->blocks().begin(), L->blocks().end(),
+                       [](BasicBlock *BB) { return BB; });
+    if (BBI != L->blocks().end() &&
+        isFunctionInPrintList((*BBI)->getParent()->getName()))
+      P.run(*L);
     return false;
   }
 };