[cfe-commits] r58982 - /cfe/trunk/lib/Analysis/RegionStore.cpp

Zhongxing Xu xuzhongxing at gmail.com
Mon Nov 10 01:39:05 PST 2008


Author: zhongxingxu
Date: Mon Nov 10 03:39:04 2008
New Revision: 58982

URL: http://llvm.org/viewvc/llvm-project?rev=58982&view=rev
Log:
Implement RegionStoreManager::RemoveDeadBindings(). This prunes several false warning caused by removal of symbolic constraints. Currently we just mark all symbols live. Further optimization for dead binding removal needed.

Modified:
    cfe/trunk/lib/Analysis/RegionStore.cpp

Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=58982&r1=58981&r2=58982&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Mon Nov 10 03:39:04 2008
@@ -83,10 +83,7 @@
 
   Store RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live,
                            llvm::SmallVectorImpl<const MemRegion*>& RegionRoots,
-                           LiveSymbolsTy& LSymbols, DeadSymbolsTy& DSymbols) {
-    // FIXME: Implement this.
-    return store;
-  }
+                           LiveSymbolsTy& LSymbols, DeadSymbolsTy& DSymbols);
 
   Store BindDecl(Store store, const VarDecl* VD, Expr* Ex, SVal InitVal, 
                  unsigned Count);
@@ -432,6 +429,25 @@
   return store;
 }
 
+Store RegionStoreManager::RemoveDeadBindings(Store store, Stmt* Loc, 
+                                             const LiveVariables& Live,
+                           llvm::SmallVectorImpl<const MemRegion*>& RegionRoots,
+                           LiveSymbolsTy& LSymbols, DeadSymbolsTy& DSymbols) {
+
+  RegionBindingsTy B = GetRegionBindings(store);
+  typedef SVal::symbol_iterator symbol_iterator;
+
+  // FIXME: Mark all region binding value's symbol as live. We also omit symbols
+  // in SymbolicRegions.
+  for (RegionBindingsTy::iterator I = B.begin(), E = B.end(); I != E; ++I) {
+    SVal X = I.getData();
+    for (symbol_iterator SI=X.symbol_begin(), SE=X.symbol_end(); SI!=SE; ++SI)
+      LSymbols.insert(*SI);
+  }
+
+  return store;
+}
+
 void RegionStoreManager::print(Store store, std::ostream& Out, 
                                const char* nl, const char *sep) {
   llvm::raw_os_ostream OS(Out);





More information about the cfe-commits mailing list