Open Bug 2000677 Opened 18 days ago Updated 3 days ago

Optimize ref tests/casts dominated by other tests/casts

Categories

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

enhancement

Tracking

()

ASSIGNED

People

(Reporter: bvisness, Assigned: bvisness)

References

(Blocks 1 open bug)

Details

Attachments

(3 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

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: