Commit 5d913223 authored by jing.bao's avatar jing.bao Committed by Commit Bot

[regalloc] Correct initialized free pos to make sure hint reg as preference

Currently, the code does not take hint register in preference.
This CL initializes current_free according to initial reg (which maybe hint_reg),
to ensure that any candidate that equals this one won't replace hint register.
Contributed by yolanda.chen@intel.com

Change-Id: I6acc1d031e6b130e69d650667dbf98551c52ff7f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1973671
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65628}
parent c6b1b845
......@@ -4263,7 +4263,7 @@ int LinearScanAllocator::PickRegisterThatIsAvailableLongest(
// set before the call. Hence, the argument registers always get ignored,
// as their available time is shorter.
int reg = (hint_reg == kUnassignedRegister) ? codes[0] : hint_reg;
int current_free = -1;
int current_free = free_until_pos[reg].ToInstructionIndex();
for (int i = 0; i < num_codes; ++i) {
int code = codes[i];
// Prefer registers that have no fixed uses to avoid blocking later hints.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment