jameysharp added the enhancement label to Issue #8200.
jameysharp added the performance label to Issue #8200.
jameysharp added the wasmtime label to Issue #8200.
jameysharp opened issue #8200:
Feature
When a WebAssembly table is declared with a maximum size that equals its minimum size, we should be able to GVN the table's base address, and also hoist loads of the base address out of loops.
Benefit
Any time there is a sequence of table accesses (
table.get
,table.set
,call_indirect
) or a loop of such, this would allow us to remove all the base-address loads after the first one, as well as subsequent address computations for instructions which access the same table element.Implementation
The egraph pass will optimize this for us as long as we add the
readonly
flag to those loads, but that's only safe if we know that the storage for the table won't be reallocated. We can be sure of that if the table can't grow because its size is fixed.Alternatives
No alternatives besides keeping things as they are.
cc: @cfallin
alexcrichton closed issue #8200:
Feature
When a WebAssembly table is declared with a maximum size that equals its minimum size, we should be able to GVN the table's base address, and also hoist loads of the base address out of loops.
Benefit
Any time there is a sequence of table accesses (
table.get
,table.set
,call_indirect
) or a loop of such, this would allow us to remove all the base-address loads after the first one, as well as subsequent address computations for instructions which access the same table element.Implementation
The egraph pass will optimize this for us as long as we add the
readonly
flag to those loads, but that's only safe if we know that the storage for the table won't be reallocated. We can be sure of that if the table can't grow because its size is fixed.Alternatives
No alternatives besides keeping things as they are.
cc: @cfallin
Last updated: Dec 23 2024 at 12:05 UTC