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

OptimizeAddedConstants: Handle a final added constant properly #6115

Merged
merged 3 commits into from
Nov 14, 2023
Merged

Conversation

kripken
Copy link
Member

@kripken kripken commented Nov 13, 2023

We had an assert there that was wrong. In fact the assert is just in one of two code paths,
and an optional one: the end situation is we have an expression and a constant to add to it,
and the assert was in the case that the expression is a Const so we can do the add at
compile time (the other code path does the add at runtime). This code path is optional as
Precompute would do such compile-time addition anyhow, but it is nice to fix and leave that
path so that this pass emits fully optimal code.

@kripken kripken requested a review from tlively November 13, 2023 20:22
src/passes/OptimizeInstructions.cpp Outdated Show resolved Hide resolved
Co-authored-by: Thomas Lively <tlively@google.com>
@kripken kripken merged commit c0d1902 into main Nov 14, 2023
14 checks passed
@kripken kripken deleted the oac.fix branch November 14, 2023 01:00
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
…sembly#6115)

We had an assert there that was wrong. In fact the assert is just in one of two code paths,
and an optional one: the end situation is we have an expression and a constant to add to it,
and the assert was in the case that the expression is a Const so we can do the add at
compile time (the other code path does the add at runtime). This code path is optional as
Precompute would do such compile-time addition anyhow, but it is nice to fix and leave that
path so that this pass emits fully optimal code.
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

Successfully merging this pull request may close these issues.

2 participants