[regalloc] Tweak heuristic for picking free register
This change makes it less likely to pick one of the registers that are not byte addressable on ia32. This is not a correctness issue but fixes some code size and runtime regressions. After the change to prefer registers that are not used in hinting, it was very likely that one of the registers that are not byte addressable was chosen, leading to extra code in cases where the carry flags was materialized as a real boolean value. With this change, we pick the first register that is not used in hinting, thereby mostly using byte addressable registers on ia32. Change-Id: I42968cf3fd7b7db949d275c40d0afeb74b5e48c3 Reviewed-on: https://chromium-review.googlesource.com/c/1404450 Reviewed-by: Sigurd Schneider <sigurds@chromium.org> Commit-Queue: Stephan Herhut <herhut@chromium.org> Cr-Commit-Position: refs/heads/master@{#58726}
This commit is contained in:
parent
92843517b3
commit
63e2c114d3
@ -3294,10 +3294,13 @@ bool LinearScanAllocator::TryAllocateFreeReg(
|
||||
for (int i = 0; i < num_codes; ++i) {
|
||||
int code = codes[i];
|
||||
// Prefer registers that have no fixed uses to avoid blocking later hints.
|
||||
// We use the first register that has no fixed uses to ensure we use
|
||||
// byte addressable registers in ia32 first.
|
||||
int candidate_free = free_until_pos[code].ToInstructionIndex();
|
||||
int current_free = free_until_pos[reg].ToInstructionIndex();
|
||||
if (candidate_free > current_free ||
|
||||
(candidate_free == current_free && reg != hint_reg &&
|
||||
data()->HasFixedUse(current->representation(), reg) &&
|
||||
!data()->HasFixedUse(current->representation(), code))) {
|
||||
reg = code;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user