Bug 150775 - B3::LowerToAir should do copy propagation
Summary: B3::LowerToAir should do copy propagation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks: 150279 150845
  Show dependency treegraph
 
Reported: 2015-11-01 09:19 PST by Filip Pizlo
Modified: 2015-11-03 14:05 PST (History)
10 users (show)

See Also:


Attachments
the patch (6.79 KB, patch)
2015-11-03 12:24 PST, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (7.01 KB, patch)
2015-11-03 12:27 PST, Filip Pizlo
ggaren: 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-11-01 09:19:09 PST
For example, the Trunc value in B3 is really just an identity in Air.  Currently we emit a Move.  But, it would be more efficient to copy propagate: just set the tmp of the Trunc to the tmp of the input.

We could do similar things for ZExt and SExt.  For ZExt, we could record if the tmp for the input value was produced by an instruction that already zero-extends.  For SExt, we could record if the tmp for the input value was produced by an instruction that already sign-extends.  For both of them, we could also use an analysis of whether the input is non-negative.  If so, the we could copy-propagate through ZExt and SExt provided that the source either zero- or sign-extended.  For example, we could copy-prop through a SExt if the source zero-extended and the value is proved non-negative.
Comment 1 Filip Pizlo 2015-11-01 09:20:45 PST
Interestingly though, we may not need to do anything special for SExt.  The FTL is already smart enough to use ZExt in all those cases where the input is non-negative.
Comment 2 Filip Pizlo 2015-11-03 12:24:06 PST
Created attachment 264709 [details]
the patch
Comment 3 Filip Pizlo 2015-11-03 12:27:10 PST
Created attachment 264710 [details]
the patch
Comment 4 Geoffrey Garen 2015-11-03 13:13:53 PST
Comment on attachment 264710 [details]
the patch

r=me
Comment 5 Filip Pizlo 2015-11-03 14:05:02 PST
Landed in http://trac.webkit.org/changeset/191977