Closed Bug 1863609 Opened 7 months ago Closed 2 months ago

Optimize away a ref.cast that is dominated by a ref.test

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
126 Branch
Tracking Status
firefox126 --- fixed

People

(Reporter: rhunt, Assigned: bvisness)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

For a snippet like:

if (x instanceof Foo) {
  (Foo)x
}

Compilers might generate a ref.test for the conditional and a ref.cast for the interior. We should be able to optimize away the second type check. We may already do this in MIR, but it'd be good to double check.

Assignee: nobody → bvisness

This patch also enables GVN of redundant MTest instructions, where an
MTest is dominated by either the true or false path of a previous MTest
on the same value. This can remove some tests entirely, such as the
trapping path from the cast instruction suggested in the bug.

Pushed by bvisness@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/41ece3527411
Enable GVN of wasm subtype checks. r=rhunt
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch
Blocks: 1892721
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: