[PATCH] D31886: [analyzer] Simplify values in binary operations more aggressively
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 10 11:07:48 PDT 2017
NoQ created this revision.
SValBuilder tries to constant-fold symbols in the left-hand side of the symbolic expression whenever it fails to evaluate the expression directly. However, it only constant-folds them when they are atomic expressions, not when they are complicated expressions themselves. This patch adds recursive constant-folding to the left-hand side expression (there's a lack of symmetry because we're trying to have symbols on the left and constants on the right). As an example, we'd now be able to handle operations similar to "$x + 1 < $y", when $x is constrained to a constant.
The constant-folding procedure, which i put into `SValBuilder::simplifySVal()`, is reusable, and i suspect that there are numerous places around `SValBuilder`, `ConstraintManager`, and our checkers, where it could be useful, but this patch tries to be relatively careful.
I'm still to see how it affects performance.
https://reviews.llvm.org/D31886
Files:
include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
test/Analysis/additive-folding.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31886.94670.patch
Type: text/x-patch
Size: 5656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170410/ec5aac74/attachment-0001.bin>
More information about the cfe-commits
mailing list