When processing the transfer function for a statement, evaluate
RemoveDeadBindings early because (1) it will always be called and (2) we can
dispatch to a plug-in transfer function that can evaluate the effect of dead
symbols (not yet added).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48114 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp
index e8d0306..932372c 100644
--- a/Analysis/GRExprEngine.cpp
+++ b/Analysis/GRExprEngine.cpp
@@ -39,16 +39,6 @@
 using llvm::cast;
 using llvm::APSInt;
 
-ValueState* GRExprEngine::RemoveDeadBindings(ValueState* St) {
-  
-  if (StateCleaned || !CurrentStmt)
-    return St;
-  
-  StateCleaned = true;
-  
-  return StateMgr.RemoveDeadBindings(St, CurrentStmt, Liveness);
-}
-
 
 ValueState* GRExprEngine::getInitialState() {
 
@@ -420,7 +410,13 @@
   StmtEntryNode = builder.getLastNode();
   CurrentStmt = S;
   NodeSet Dst;
-  StateCleaned = false;
+  
+  // Create the cleaned state.
+
+  RDBInState = StmtEntryNode->getState();
+  RDBOutState = StateMgr.RemoveDeadBindings(RDBInState, CurrentStmt, Liveness);
+
+  // Visit the statement.
 
   Visit(S, StmtEntryNode, Dst);
 
@@ -428,10 +424,7 @@
   // dead mappings removed.
   
   if (Dst.size() == 1 && *Dst.begin() == StmtEntryNode) {
-    ValueState* St =
-      StateCleaned ? StmtEntryNode->getState() : 
-                     RemoveDeadBindings(StmtEntryNode->getState());
-    
+    ValueState* St = RemoveDeadBindings(StmtEntryNode->getState());
     builder.generateNode(S, St, StmtEntryNode);
   }
   
@@ -440,6 +433,8 @@
   CurrentStmt = NULL;
   StmtEntryNode = NULL;
   Builder = NULL;
+  RDBInState = NULL;
+  RDBOutState = NULL;
 }
 
 void GRExprEngine::VisitDeclRefExpr(DeclRefExpr* D, NodeTy* Pred, NodeSet& Dst){