Bug 228615 - [JSC/Air] Optimize enableMovesOnValueAndAdjacents in IRC
Summary: [JSC/Air] Optimize enableMovesOnValueAndAdjacents in IRC
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Robin Morisset
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-07-29 15:37 PDT by Robin Morisset
Modified: 2021-11-18 22:06 PST (History)
7 users (show)

See Also:


Attachments
Patch (4.54 KB, patch)
2021-07-29 15:50 PDT, Robin Morisset
saam: review+
Details | Formatted Diff | Diff
Patch (4.51 KB, patch)
2021-11-18 14:31 PST, Robin Morisset
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Morisset 2021-07-29 15:37:04 PDT
The Iterated Register Coalescing (IRC) register coalescing spends a very significant fraction of its time in JS2 in enableMovesOnValueAndAdjacents (816ms out of 2.07s spent in register allocation for Wasm code in one particular run).
The reason is that if this function is called on N nodes that are neighbors of each other, then enableMovesOnValue (which is kinda expensive as it iterates a SmallSet which is not always small) will be called N times on each of the N nodes. This can trivially be fixed by keeping track of which nodes need enableMovesOnValue called on them and only calling it on them once.
Comment 1 Robin Morisset 2021-07-29 15:50:06 PDT
Created attachment 434580 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2021-08-05 15:37:16 PDT
<rdar://problem/81587890>
Comment 3 Saam Barati 2021-11-17 16:14:30 PST
Comment on attachment 434580 [details]
Patch

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

> Source/JavaScriptCore/b3/air/AirAllocateRegistersByGraphColoring.cpp:1322
> +    // Set of Tmps whose moves are now ready for possible coalescing.
> +    BitVector m_hasMovesToEnable;

nit: I'd name this "m_movesToEnable"
Comment 4 Robin Morisset 2021-11-18 14:31:43 PST
Created attachment 444739 [details]
Patch
Comment 5 EWS 2021-11-18 22:06:41 PST
Committed r286045 (244432@main): <https://commits.webkit.org/244432@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 444739 [details].