Skip to content

Update GTO and TypeRefining for Struct RMW operations - #7262

Merged
tlively merged 4 commits into
mainfrom
struct-rmw-gto-type-refining
Feb 4, 2025
Merged

tlively merged 4 commits into
mainfrom
struct-rmw-gto-type-refining

Conversation

@tlively

@tlively tlively commented Feb 1, 2025

Copy link
Copy Markdown
Member

Both passes use StructUtils::StructScanner to analyze struct operations.
Add support for RMW operations to this utility and update its users to
provide the new noteRMW hook. Test that GTO and TypeRefining
optimizations work as expected in the presence of RMW operations, but
leave a proper implementation in ConstantFieldPropagation to a later PR.

To allow TypeRefining to refine field types based only on the
"replacement" operand and not the "expected" operand of cmpxchg
operations, update validation to allow the "expected" field to be a
supertype of the accessed field type as long as it is still equality
comparable.
WebAssembly/shared-everything-threads#92
clarifies this intended typing in the upstream proposal.

Both passes use StructUtils::StructScanner to analyze struct operations.
Add support for RMW operations to this utility and update its users to
provide the new `noteRMW` hook. Test that GTO and TypeRefining
optimizations work as expected in the presence of RMW operations, but
leave a proper implementation in ConstantFieldPropagation to a later PR.

To allow TypeRefining to refine field types based only on the
"replacement" operand and not the "expected" operand of cmpxchg
operations, update validation to allow the "expected" field to be a
supertype of the accessed field type as long as it is still equality
comparable.
WebAssembly/shared-everything-threads#92
clarifies this intended typing in the upstream proposal.
@tlively
tlively requested a review from kripken February 1, 2025 03:00
Comment thread src/ir/struct-utils.h Outdated
auto heapType = type.getHeapType();
auto index = curr->index;
auto& info =
functionSetGetInfos[this->getFunction()][type.getHeapType()][curr->index];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
functionSetGetInfos[this->getFunction()][type.getHeapType()][curr->index];
functionSetGetInfos[this->getFunction()][type.getHeapType()][index];

@tlively
tlively enabled auto-merge (squash) February 3, 2025 22:07
@tlively
tlively merged commit b35228f into main Feb 4, 2025
@tlively
tlively deleted the struct-rmw-gto-type-refining branch February 4, 2025 00:24
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