Major cleanup of the transfer function logic for '&&', '||', and '?'.  We
now store in the state essentially which branch we took.  This removes
a bunch of bogus assumptions (and likely bugs), reduces the complexity of
the implementation, and facilitates more optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47613 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/ValueState.cpp b/Analysis/ValueState.cpp
index 03b2996..ab208ff 100644
--- a/Analysis/ValueState.cpp
+++ b/Analysis/ValueState.cpp
@@ -69,10 +69,14 @@
         MarkedSymbols.insert(*SI);
       }
     }
-    else
+    else {
+      RVal X = I.getData();
+      
+      if (X.isUninit() && cast<UninitializedVal>(X).getData())
+        continue;
+      
       NewSt.BlockExprBindings = Remove(NewSt, BlkExpr);
-    
-    continue;
+    }
   }
 
   // Iterate over the variable bindings.
@@ -209,7 +213,7 @@
   return getPersistentState(NewSt);
 }
 
-RVal ValueStateManager::GetRVal(ValueState St, Expr* E, bool* hasVal) {
+RVal ValueStateManager::GetRVal(ValueState St, Expr* E) {
 
   for (;;) {
     
@@ -322,21 +326,15 @@
   
   ValueState::ExprBindingsTy::TreeTy* T = St->SubExprBindings.SlimFind(E);
   
-  if (T) {
-    if (hasVal) *hasVal = true;
-    return T->getValue().second;
-  }
+  return T ? T->getValue().second : GetBlkExprRVal(St, E);
+}
+
+RVal ValueStateManager::GetBlkExprRVal(ValueState St, Expr* E) {
   
-  T = St->BlockExprBindings.SlimFind(E);  
-  
-  if (T) {
-    if (hasVal) *hasVal = true;
-    return T->getValue().second;
-  }
-  else {
-    if (hasVal) *hasVal = false;
-    return UnknownVal();
-  }
+  assert (!isa<ParenExpr>(E));
+
+  ValueState::ExprBindingsTy::TreeTy* T = St->BlockExprBindings.SlimFind(E);    
+  return T ? T->getValue().second : UnknownVal();
 }
 
 RVal ValueStateManager::GetLVal(ValueState St, Expr* E) {