Closed Bug 1917817 Opened 4 months ago Closed 4 months ago

Improve live range building for loops

Categories

(Core :: JavaScript Engine: JIT, task, P1)

task

Tracking

()

RESOLVED FIXED
132 Branch
Tracking Status
firefox132 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(3 files)

VirtualRegister::addInitialRange can be slow because for loops we can call that with a range that should be inserted or merged at an arbitrary position in the list. It also has a CoalesceLimit threshold and after that point we stop trying to merge ranges.

This is done because initially MIR loop blocks were not contiguous, but they are contiguous nowadays so we can now add a live range for the whole loop at once. This also lets us simplify addInitialRange because it then only has to insert or merge ranges at the front of the list.

Severity: -- → N/A
Priority: -- → P1

For the function below we'll now move the return-block after the outer
loop also if we enter the inner loop through OSR.

function f(x) {
    for (var i = 0; i < 1000; i++) {
        for (var j = 0; j < 200; j++) {}
        if (x) {
            return 1;
        }
    }
}
f(false);

Loops used to not be contiguous in the MIR graph, but this is no longer the case.

After the previous patch, ranges are now always inserted or merged at the beginning
of the list.

Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8a367de494ea part 1 - Support loops with OSR in MakeLoopsContiguous. r=nbp https://hg.mozilla.org/integration/autoland/rev/3d1153094910 part 2 - Rely on contiguous loops during live range building. r=jseward https://hg.mozilla.org/integration/autoland/rev/8bc2884721f0 part 3 - Simplify VirtualRegister::addInitialRanage. r=jseward
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 132 Branch

This may have lead to 3.1% imrpovement on Jetstream2-tsf-wasm-Runtime
1.9% improvement on wasm-misc-optimizing-compile . However, this improved returned to the baseline after bug 1918970

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: