[PATCH] D152093: [clang][Analysis] Handle && and || against variable and its negation as tautology
Nico Weber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 7 10:19:05 PDT 2023
thakis added a comment.
Seems like a nice idea to me, thanks!
Do you have any numbers on how often this fires in practice, and what the true positive rate is? (Build some large-ish open source project with this, and see what it finds.)
Did you verify that this has negligible compile time impact for building a large-ish project?
With that, looks good.
================
Comment at: clang/lib/Analysis/CFG.cpp:1096
+ if (Negate->getOpcode() == UO_LNot &&
+ Expr::isSameComparisonOperand(Negate->getSubExpr(), E2)) {
+ bool AlwaysTrue = B->getOpcode() == BO_LOr;
----------------
Do you want to IgnoreParens() on the ! subexpr too?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152093/new/
https://reviews.llvm.org/D152093
More information about the cfe-commits
mailing list