Skip to content

Commit

Permalink
Small code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-hildred committed Apr 11, 2024
1 parent dd49b09 commit 8f4f3aa
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Analyzer/Passes/LogicalExpressionOptimizerPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,14 +603,12 @@ class LogicalExpressionOptimizerVisitor : public InDepthQueryTreeVisitorWithCont
else
return;

bool need_invert = (constant_value == 0);

const FunctionNode * child_function = is_lhs_const ? rhs->as<FunctionNode>() : lhs->as<FunctionNode>();

if (!child_function || !isBooleanFunction(child_function->getFunctionName()))
return;

if (need_invert)
// if we have something like `function = 0`, we need to add a `NOT` when dropping the `= 0`
if (constant_value == 0)
{
auto not_resolver = FunctionFactory::instance().get("not", getContext());
const auto not_node = std::make_shared<FunctionNode>("not");
Expand Down

0 comments on commit 8f4f3aa

Please sign in to comment.