Closed Bug 2000677 Opened 1 year ago Closed 10 months ago

Optimize ref tests/casts dominated by other tests/casts

Categories

(Core :: JavaScript: WebAssembly, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
149 Branch
Tracking Status
firefox149 --- fixed

People

(Reporter: bvisness, Assigned: bvisness)

References

(Blocks 1 open bug)

Details

Attachments

(4 external files, 1 obsolete file)

There are optimizations we could perform to tighten up ref.test and ref.cast. For example, a ref.cast dominated by a ref.test of the same type could be omitted.

This allows ref.is_null to participate in other optimizations around
tests and casts.

Severity: -- → N/A
Priority: -- → P2

I don't think we'll actually do anything with this patch because it
doesn't seem worthwhile to remove redundant casts this way. It should be
covered by other work on this bug.

Attachment #9530346 - Attachment is obsolete: true

The LUB seemed like the conservative choice when commoning up nodes
during GVN, but actually this is somewhat wrong. Combining the types
from two equivalent nodes is not like combining the types in a phi; in
the latter case the values are not equivalent and therefore you must
find an upper bound, while in the former the values are equivalent and
therefore you can safely take a lower bound.

This restores the property that ref types only lower over the course of
optimization, which makes everything more sane and predictable.

There is a suite of optimizations we can make when ref.test and ref.cast
instructions dominate each other. This is not yet captured by any other
optimizations but should particularly help the pattern of:

local.get $obj
ref.test (ref $t)
if
local.get $obj
ref.cast $obj
...
end

Attachment #9527757 - Attachment description: WIP: Bug 2000677: Emit ref.test for ref.is_null → Bug 2000677: Emit ref.test for ref.is_null. r=rhunt
Attachment #9530378 - Attachment description: WIP: Bug 2000677: Use GLB instead of LUB in GVN. → Bug 2000677: Use GLB instead of LUB in GVN. r=iain
Attachment #9530515 - Attachment description: WIP: Bug 2000677: Add ref.test/ref.cast optimization pass. → Bug 2000677: Add ref.test/ref.cast optimization pass. r=rhunt,iain

Adds some utilities for testing the output of wasmDumpIon.

See Also: → 2010763
QA Whiteboard: [qa-triage-done-c150/b149]
Regressions: 2021627
See Also: → 1936339
No longer blocks: wasm-ref-mir
Blocks: wasm-perf
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: