Added assumption logic for symbolic non-lvalues when used in conditions such as
"if(x)". On the true branch we know the value is != 0, and on the false branch
we know it is 0.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46814 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp
index bd5cb06..a9371ee 100644
--- a/Analysis/GRConstants.cpp
+++ b/Analysis/GRConstants.cpp
@@ -898,6 +898,19 @@
assert (false && "'Assume' not implemented for this NonLValue.");
return St;
+
+ case nonlval::SymbolValKind: {
+ lval::SymbolVal& SV = cast<lval::SymbolVal>(Cond);
+ SymbolID sym = SV.getSymbol();
+
+ if (Assumption)
+ return AssumeSymNE(St, sym, ValMgr.getValue(0, SymMgr.getType(sym)),
+ isFeasible);
+ else
+ return AssumeSymEQ(St, sym, ValMgr.getValue(0, SymMgr.getType(sym)),
+ isFeasible);
+ }
+
case nonlval::SymIntConstraintValKind:
return
AssumeSymInt(St, Assumption,