Skip to content

Commit

Permalink
programmemory.cpp: avoid unnecessary infer() calls in `Executor::ex…
Browse files Browse the repository at this point in the history
…ecuteimpl()`
  • Loading branch information
firewave committed Jul 22, 2024
1 parent d03d820 commit 3ae3e59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/programmemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,13 +1506,13 @@ namespace {
if (!lhs.isUninitValue() && !rhs.isUninitValue())
r = evaluate(expr->str(), lhs, rhs);
if (expr->isComparisonOp() && (r.isUninitValue() || r.isImpossible())) {
if (rhs.isIntValue()) {
if (rhs.isIntValue() && !expr->astOperand1()->values().empty()) {
std::vector<ValueFlow::Value> result =
infer(ValueFlow::makeIntegralInferModel(), expr->str(), expr->astOperand1()->values(), {std::move(rhs)});
if (!result.empty() && result.front().isKnown())
return result.front();
}
if (lhs.isIntValue()) {
if (lhs.isIntValue() && !expr->astOperand2()->values().empty()) {
std::vector<ValueFlow::Value> result =
infer(ValueFlow::makeIntegralInferModel(), expr->str(), {std::move(lhs)}, expr->astOperand2()->values());
if (!result.empty() && result.front().isKnown())
Expand Down

0 comments on commit 3ae3e59

Please sign in to comment.