| Index: src/compiler/register-allocator.cc
|
| diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc
|
| index 36d670350a7d6f6726076a2b36752c2c68fbc141..5515843612dd12759c846a7601f4e66fc806a8e7 100644
|
| --- a/src/compiler/register-allocator.cc
|
| +++ b/src/compiler/register-allocator.cc
|
| @@ -3175,6 +3175,9 @@ void LinearScanAllocator::AllocateBlockedReg(LiveRange* current) {
|
| rep == MachineRepresentation::kSimd128))
|
| GetFPRegisterSet(rep, &num_regs, &num_codes, &codes);
|
|
|
| + // use_pos keeps track of positions a register/alias is used at.
|
| + // block_pos keeps track of positions where a register/alias is blocked
|
| + // from.
|
| LifetimePosition use_pos[RegisterConfiguration::kMaxFPRegisters];
|
| LifetimePosition block_pos[RegisterConfiguration::kMaxFPRegisters];
|
| for (int i = 0; i < num_regs; i++) {
|
| @@ -3190,6 +3193,8 @@ void LinearScanAllocator::AllocateBlockedReg(LiveRange* current) {
|
| block_pos[cur_reg] = use_pos[cur_reg] =
|
| LifetimePosition::GapFromInstructionIndex(0);
|
| } else {
|
| + DCHECK_NE(LifetimePosition::GapFromInstructionIndex(0),
|
| + block_pos[cur_reg]);
|
| use_pos[cur_reg] =
|
| range->NextLifetimePositionRegisterIsBeneficial(current->Start());
|
| }
|
| @@ -3205,7 +3210,9 @@ void LinearScanAllocator::AllocateBlockedReg(LiveRange* current) {
|
| LifetimePosition::GapFromInstructionIndex(0);
|
| } else {
|
| use_pos[aliased_reg] =
|
| - range->NextLifetimePositionRegisterIsBeneficial(current->Start());
|
| + Min(block_pos[aliased_reg],
|
| + range->NextLifetimePositionRegisterIsBeneficial(
|
| + current->Start()));
|
| }
|
| }
|
| }
|
| @@ -3219,10 +3226,12 @@ void LinearScanAllocator::AllocateBlockedReg(LiveRange* current) {
|
| // Don't perform costly intersections if they are guaranteed to not update
|
| // block_pos or use_pos.
|
| // TODO(mtrofin): extend to aliased ranges, too.
|
| - if ((kSimpleFPAliasing || !check_fp_aliasing()) && is_fixed) {
|
| - if (block_pos[cur_reg] < range->Start()) continue;
|
| - } else {
|
| - if (use_pos[cur_reg] < range->Start()) continue;
|
| + if ((kSimpleFPAliasing || !check_fp_aliasing())) {
|
| + if (is_fixed) {
|
| + if (block_pos[cur_reg] < range->Start()) continue;
|
| + } else {
|
| + if (use_pos[cur_reg] < range->Start()) continue;
|
| + }
|
| }
|
|
|
| LifetimePosition next_intersection = range->FirstIntersection(current);
|
|
|