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.
Created attachment 434580 [details] Patch
<rdar://problem/81587890>
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"
Created attachment 444739 [details] Patch
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].