[webkit-reviews] review requested: [Bug 194081] B3 should use associativity to optimize expression trees : [Attachment 366657] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 3 15:31:42 PDT 2019

Robin Morisset <rmorisset at apple.com> has asked	for review:
Bug 194081: B3 should use associativity to optimize expression trees

Attachment 366657: Patch


--- Comment #15 from Robin Morisset <rmorisset at apple.com> ---
Created attachment 366657

  --> https://bugs.webkit.org/attachment.cgi?id=366657&action=review


I wrote three microbenchmarks. None of them had any speedups. Upon
investigating, I found that CSE tends to leave around dead values that are only
eliminated much further (in the ReduceStrength just after my optimizations).
This was a problem, as my optimization pass gives up when a node got a use
count greater than one, and these dead values were using various subtrees.

So I ripped out killDeadCode from B3ReduceStrength, made it its own pass and
added it after CSE. This worked: 2 of the three microbenchmarks now show wins
of respectively 16% and 42%.

More surprisingly and very happily, this dead code elimination by itself was a
massive win on a few other microbenchmarks: 50% on instanceof-always-hit-two
and 16% on two variations of licm-dragons.
I suspect it is by enabling B3TailDuplication to do its work, as it runs after
CSE, and needs tiny blocks to be able to do anything.

I sent this patch to the bots for more serious performance results on
JetStream2, I will update this bug as soon as the results come in.

Beyond that the only difference with the previous patch, is that my pass now
skips trees of size 3, as B3ReduceStrength can deal with them. This should help
avoid a possible hit to compile time.

More information about the webkit-reviews mailing list