Fix regression by explicitly checking if we are negating a SymIntConstantVal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53753 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/GRSimpleVals.cpp b/lib/Analysis/GRSimpleVals.cpp
index 6cb714a..36e7233 100644
--- a/lib/Analysis/GRSimpleVals.cpp
+++ b/lib/Analysis/GRSimpleVals.cpp
@@ -472,11 +472,16 @@
         return UnknownVal();
         
       case nonlval::SymIntConstraintValKind: {
+        
+        // Logical not?        
+        if (!(Op == BinaryOperator::EQ && R.isZeroConstant()))
+          return UnknownVal();
+        
         const SymIntConstraint& C =
           cast<nonlval::SymIntConstraintVal>(L).getConstraint();
         
         BinaryOperator::Opcode Opc = C.getOpcode();
-
+        
         if (Opc < BinaryOperator::LT || Opc > BinaryOperator::NE)
           return UnknownVal();
 
diff --git a/lib/Analysis/RValues.cpp b/lib/Analysis/RValues.cpp
index 60c3494..ed3dba9 100644
--- a/lib/Analysis/RValues.cpp
+++ b/lib/Analysis/RValues.cpp
@@ -55,6 +55,20 @@
 }
 
 //===----------------------------------------------------------------------===//
+// Useful predicates.
+//===----------------------------------------------------------------------===//
+
+bool RVal::isZeroConstant() const {
+  if (isa<lval::ConcreteInt>(*this))
+    return cast<lval::ConcreteInt>(*this).getValue() == 0;
+  else if (isa<nonlval::ConcreteInt>(*this))
+    return cast<nonlval::ConcreteInt>(*this).getValue() == 0;
+  else
+    return false;
+}
+
+
+//===----------------------------------------------------------------------===//
 // Transfer function dispatch for Non-LVals.
 //===----------------------------------------------------------------------===//