Skip to content

Commit

Permalink
check whether 'e.prop == bool' expr is evaluable before rewriting them.
Browse files Browse the repository at this point in the history
  • Loading branch information
xtcyclist committed Nov 9, 2022
1 parent d9c4a6c commit 4283b0c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/graph/util/ExpressionUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,10 +614,13 @@ Expression *ExpressionUtils::rewriteRelExpr(const Expression *expr) {
auto rExpr = relExpr->right();

// Simplify relational expressions involving boolean literals
auto simplifiedExpr = simplifyBoolOperand(relExpr, lExpr, rExpr);
if (simplifiedExpr) {
return simplifiedExpr;
if (isEvaluableExpr(lExpr) && isEvaluableExpr(rExpr)) {
auto simplifiedExpr = simplifyBoolOperand(relExpr, lExpr, rExpr);
if (simplifiedExpr) {
return simplifiedExpr;
}
}

// Move all evaluable expression to the right side
auto relRightOperandExpr = relExpr->right()->clone();
auto relLeftOperandExpr = rewriteRelExprHelper(relExpr->left(), relRightOperandExpr);
Expand Down

0 comments on commit 4283b0c

Please sign in to comment.