[PATCH] D39707: [analyzer] assume bitwise arithmetic axioms

2017-11-09 Thread George Karpenkov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL317820: [analyzer] assume bitwise arithmetic axioms (authored by george.karpenkov). Changed prior to commit: https://reviews.llvm.org/D39707?vs=122170&id=122278#toc Repository: rL LLVM https://revie

[PATCH] D39707: [analyzer] assume bitwise arithmetic axioms

2017-11-09 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin added a comment. This looks good to me. It is very clean! But please add a comment in the places where you are assuming a two's complement value representation for signed integers. https://reviews.llvm.org/D39707 ___ cfe-commits mailing

[PATCH] D39707: [analyzer] assume bitwise arithmetic axioms

2017-11-08 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov updated this revision to Diff 122170. george.karpenkov added a comment. Handle non-zero case, more tests cases, cleaner code. https://reviews.llvm.org/D39707 Files: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp test/Analysis/constant-folding.c Index: test/Analysis/con

[PATCH] D39707: [analyzer] assume bitwise arithmetic axioms

2017-11-08 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin added a comment. I believe your motivating examples used errno_t, which is a signed type. I'm fine with assuming a two's complement value representation for signed integers, which would make Artem's suggestion work. That assumption definitely deserves a comment, though. https://revi

[PATCH] D39707: [analyzer] assume bitwise arithmetic axioms

2017-11-07 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision. NoQ added a comment. Yep, nice and clean~ Comment at: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:520 + Result = applyBitwiseConstraints(BV, F, T, Result, Sym); return Result; That's more and more "special case"s, i gues

[PATCH] D39707: [analyzer] assume bitwise arithmetic axioms

2017-11-07 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun accepted this revision. xazax.hun added a comment. This revision is now accepted and ready to land. This looks like a great addition! Apart from some nits, LGTM. Comment at: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:487 + +// result >= constant +

[PATCH] D39707: [analyzer] assume bitwise arithmetic axioms

2017-11-06 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov updated this revision to Diff 121825. https://reviews.llvm.org/D39707 Files: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp test/Analysis/constant-folding.c Index: test/Analysis/constant-folding.c === --- t

[PATCH] D39707: [analyzer] assume bitwise arithmetic axioms

2017-11-06 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov created this revision. Herald added subscribers: szepet, xazax.hun. Patches the solver to assume that bitwise OR of an unsigned value with a constant always produces a value larger-or-equal than the constant, and bitwise AND with a constant always produces a value less-or-equal