Use feedback from RegionStoreSubRegionMap::add() to prune off adding a super
region to the worklist used to create the subregion map.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78228 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index 7020175..398babc 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -119,12 +119,16 @@
   SetTy::Factory F;
   Map M;
 public:
-  void add(const MemRegion* Parent, const MemRegion* SubRegion) {
+  bool add(const MemRegion* Parent, const MemRegion* SubRegion) {
     Map::iterator I = M.find(Parent);
-    if (I == M.end())
+
+    if (I == M.end()) {
       M.insert(std::make_pair(Parent, F.Add(F.GetEmptySet(), SubRegion)));
-    else
-      I->second = F.Add(I->second, SubRegion);
+      return true;
+    }
+
+    I->second = F.Add(I->second, SubRegion);
+    return false;
   }
     
   ~RegionStoreSubRegionMap() {}
@@ -405,9 +409,9 @@
       continue;
 
     const MemRegion *superR = R->getSuperRegion();
-    M->add(superR, R);
-    if (const SubRegion *sr = dyn_cast<SubRegion>(superR))
-      WL.push_back(sr);
+    if (M->add(superR, R))
+      if (const SubRegion *sr = dyn_cast<SubRegion>(superR))
+        WL.push_back(sr);
   }
 
   return M;