[regalloc] Find optimal spilling position when spill range to end
When spill a range without register uses inside a loop, it is beneficial to spill the range ealier at the loop header to reduce memory moves from the back edges. The changes to FindOptimalSpillingPos are motivated as follows: - Change “next_use->pos() < pos” to “next_use->pos() <= pos”. The former version causes a crash of mksnapshot in debug build, because it is possible that a UsePosition at a split point gets split to the previous range according to “DetachAt”. For example, we have a live range with: UseIntervals: [1, 20[ UsePosition: 10 When split the live range at position 10, we will get: Range 0:0: UseInterval: [1, 10[ UsePosition: 10 Range 0:1: UseInterval: [10, 20[ - Change “NextUsePositionRegisterIsBenefitial” to “NextRegisterPosition”, because there’s always a “Define” use position at the loop header for those phis that do not require a register. Using the original check will hence not apply the optimization. Change-Id: I3b0bb3687ba572f1d3fc1892cefae7e866d99baa Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2094964Reviewed-by: Sigurd Schneider <sigurds@chromium.org> Reviewed-by: Thibaud Michaud <thibaudm@chromium.org> Commit-Queue: Sigurd Schneider <sigurds@chromium.org> Commit-Queue: Yolanda Chen <yolanda.chen@intel.com> Cr-Commit-Position: refs/heads/master@{#66806}
Showing
Please
register
or
sign in
to comment