Bug 152162 - B3 should be able to sink values into checks
Summary: B3 should be able to sink values into checks
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 152224 152968
Blocks: 152106
  Show dependency treegraph
 
Reported: 2015-12-10 18:55 PST by Filip Pizlo
Modified: 2016-02-28 17:50 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2015-12-10 18:55:27 PST
B3 should sink sinkable operations to the lowest dominating point in the CFG. In case an operation's output is only used for the stackmap of Check, we should turn this:

    @a = Foo(...)
    Check(@p, @a)

into this:

    Branch(@p, #exit, #continuation)

  exit:
    @a = Foo(...)
    Check(false, @a)

  contination:
    ...

This will help with the useless Shr that we will see on some array bounds checks from asm.js code.
Comment 1 Filip Pizlo 2015-12-10 18:56:11 PST
(In reply to comment #0)
> B3 should sink sinkable operations to the lowest dominating point in the
> CFG. In case an operation's output is only used for the stackmap of Check,
> we should turn this:
> 
>     @a = Foo(...)
>     Check(@p, @a)
> 
> into this:
> 
>     Branch(@p, #exit, #continuation)
> 
>   exit:
>     @a = Foo(...)
>     Check(false, @a)
> 
>   contination:
>     ...
> 
> This will help with the useless Shr that we will see on some array bounds
> checks from asm.js code.

It's worth saying that usually, https://bugs.webkit.org/show_bug.cgi?id=152160 will obviate the need for this. But things may leak past that optimization. This optimization is more general, but it has a compile time cost due to the introduction of control flow.
Comment 2 Filip Pizlo 2015-12-12 22:26:22 PST
The priority right now is sinking into checks, not general sinking.
Comment 3 Filip Pizlo 2016-02-28 17:50:43 PST
Note that we could sink anything that the CSE can reason about.  For example, we could sink stores into checks!