Bug 141107 - Converting Flushes and PhantomLocals to Phantoms requires an OSR availability analysis rather than just using the SetLocal's child
Summary: Converting Flushes and PhantomLocals to Phantoms requires an OSR availability...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks: 140660
  Show dependency treegraph
 
Reported: 2015-01-30 19:03 PST by Filip Pizlo
Modified: 2015-02-02 10:16 PST (History)
10 users (show)

See Also:


Attachments
the patch (9.03 KB, patch)
2015-01-30 19:08 PST, Filip Pizlo
msaboff: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2015-01-30 19:03:50 PST
Consider that you have code like:

a: ...
b: MovHint(@a)
c: ValueRep(@a)
d: SetLocal(@c)
...
e: Flush(@d)

If the code between @d and @e doesn't observe the flushed value, we current convert this to:

a: ...
b: MovHint(@a)
c: ValueRep(@a)
d: SetLocal(@c)
...
e: Phantom(@c)

That's wrong, because @c is not MovHinted to anything. This causes @a to die and if we exit, we won't have a value for this local.

Our IR supports the notion that two logically equivalent but not identical values may be used for the MovHint and SetLocal.  Phantoms should use the values that MovHints used.  So, when strength-reducing a Flush or PhantomLocal to a Phantom we need to put the Phantom on the value that would have gotten MovHinted into that local.
Comment 1 Filip Pizlo 2015-01-30 19:04:24 PST
This issue was revealed by the new inlining opportunities introduced by https://bugs.webkit.org/show_bug.cgi?id=140660.
Comment 2 Filip Pizlo 2015-01-30 19:08:06 PST
Created attachment 245765 [details]
the patch
Comment 3 Michael Saboff 2015-02-02 09:41:25 PST
Comment on attachment 245765 [details]
the patch

View in context: https://bugs.webkit.org/attachment.cgi?id=245765&action=review

r=me

> Source/JavaScriptCore/dfg/DFGCPSRethreadingPhase.cpp:267
> +                // be keeping the last MovHinted value of that local alive.

Would it be better to say "keep" instead of "be keeping"?
Comment 4 Filip Pizlo 2015-02-02 09:56:40 PST
Comment on attachment 245765 [details]
the patch

View in context: https://bugs.webkit.org/attachment.cgi?id=245765&action=review

>> Source/JavaScriptCore/dfg/DFGCPSRethreadingPhase.cpp:267
>> +                // be keeping the last MovHinted value of that local alive.
> 
> Would it be better to say "keep" instead of "be keeping"?

Good point, will make that change!
Comment 5 Filip Pizlo 2015-02-02 10:16:06 PST
Landed in http://trac.webkit.org/changeset/179477