[RegionPass] Added check for -filter-print-funcs option to the region IR dumps.

Differential Revision: https://reviews.llvm.org/D114310
diff --git a/llvm/lib/Analysis/RegionPass.cpp b/llvm/lib/Analysis/RegionPass.cpp
index a73607d..c20ecff 100644
--- a/llvm/lib/Analysis/RegionPass.cpp
+++ b/llvm/lib/Analysis/RegionPass.cpp
@@ -15,6 +15,7 @@
 #include "llvm/Analysis/RegionPass.h"
 #include "llvm/IR/OptBisect.h"
 #include "llvm/IR/PassTimingInfo.h"
+#include "llvm/IR/PrintPasses.h"
 #include "llvm/IR/StructuralHash.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Timer.h"
@@ -187,6 +188,8 @@
   }
 
   bool runOnRegion(Region *R, RGPassManager &RGM) override {
+    if (!isFunctionInPrintList(R->getEntry()->getParent()->getName()))
+      return false;
     Out << Banner;
     for (const auto *BB : R->blocks()) {
       if (BB)