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

Fix selects of packed fields in GlobalStructOptimization #6947

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

kripken
Copy link
Member

@kripken kripken commented Sep 16, 2024

We emit a select between two objects when only two objects exist of a particular
type. However, if the field is packed, we did not handle truncating the written
values.

// that constant.
ret = value.getConstant().makeExpression(wasm);
// that constant, and handle if the field is packed.
auto* expr = value.getConstant().makeExpression(wasm);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth considering a refactoring that would put the knowledge that we are representing an i8 or i16 value directly into the Literal, which would prevent users from having to remember and specially handle the case of packed values.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting idea. I think perhaps not on PossibleConstantValues which just means a wasm value, not necessarily one stored to a heap field. Adding this info there would add size + overhead in places we don't need it (some passes store very many such values, e.g. GUFA). But perhaps we could have HeapStoredValue or such. I'll keep thinking about it.

@kripken kripken merged commit 0da6d3e into WebAssembly:main Sep 17, 2024
13 checks passed
@kripken kripken deleted the gsi.trunc branch September 17, 2024 18:25
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