mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-14 17:00:52 +02:00
FEX has a problem with large blocks that uses a ton of constants spread throughout the block. Once a block gets large enough with enough constants that have large live ranges, FEX slows down to unusable speeds due to the register allocator spending more time calculating node interferences than anything else in the program. This adds a little heuristic to ensure that constants aren't reused if the previous value is past a certain distance threshold. This threshold works well enough that XeSS's pedantic initialization code doesn't have issues now. See https://github.com/FEX-Emu/FEX/issues/2688 for more information about that. FEX itself should work to remove bad constant usages to make this pass less necessary anyway. In most cases we are materializing duplicated 0, 1, and masks which could be done without a constant entirely. Maybe once we've improve that enough we could remove this constant pooling entirely. To note, this doesn't fix the issue that XeSS causes our register allocator, this is purely a heuristic workaround.