[PATCH] D103317: [Analyzer][engine][solver] Simplify complex constraints
Valeriy Savchenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 28 07:03:14 PDT 2021
vsavchenko added a comment.
Looking great, thanks!
I have a couple of notes below.
================
Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:1155-1156
- // TODO: Support SymbolCast. Support IntSymExpr when/if we actually
- // start producing them.
----------------
Do we actually produce them?
================
Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:1170-1172
+ SVal LHS = getConst(S->getLHS());
+ if (LHS.isUndef())
+ LHS = Visit(S->getLHS());
----------------
It seems like a very common pattern now:
```
SVal Const = getConst(Expr);
if (Const.isUndef())
return Visit(Expr);
return Const;
```
At least we can make a function out of this, so we don't repeat this pattern over and over.
But I was thinking more radically to actually replace `Visit` with this, what do you think?
================
Comment at: clang/test/Analysis/simplify-complex-constraints.cpp:25-27
+ if (x + (y + z) != 0)
+ return 0;
+ if (y + z != 0)
----------------
Since it's not really specific to addition, maybe we can have tests for other operators?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103317/new/
https://reviews.llvm.org/D103317
More information about the cfe-commits
mailing list