Skip to content
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

Multiplication by multiple constant values don't merge correctly #6

Open
SyfSchydea opened this issue Dec 31, 2021 · 0 comments
Open

Comments

@SyfSchydea
Copy link
Owner

Doing a multiplication such as 3 * 5 * x expands correctly, but multiplications such as x * 3 * 5 do not. Multiplication between constants should be expanded first, before multiplications between expressions and constants.

Note that removing the expr.has_side_effects() guard on the variable assignment in validate_expr_mul_const is not sufficient to solve this problem. In cases such as 17 * 3, where the multiplication expansion is not the same as the multiplication written, suboptimal code will still be produced. (In this case, x*51 expands to x * 5 * 5 * 2 + x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant