Skip to content

Optimize binary operators with equal children even if side effect #7460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Format the code
  • Loading branch information
xuruiyang2002 committed Apr 7, 2025
commit 256ce96b08d78a9bb6e8c9cb827968ef3646e923
4 changes: 2 additions & 2 deletions src/passes/OptimizeInstructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,8 +859,8 @@ struct OptimizeInstructions
// finally, try more expensive operations on the curr
// regardless of whether they have side effects or not.
if (areConsecutiveInputsEqual(curr->left, curr->right)) {
if (auto* ret = optimizeBinaryWithEqualChildren(curr)) {
return replaceCurrent(ret);
if (auto *ret = optimizeBinaryWithEqualChildren(curr)) {
return replaceCurrent(ret);
}
}

Expand Down
Loading