Skip to content

Commit

Permalink
ARM64: Fix two register selection issues
Browse files Browse the repository at this point in the history
On ARM64 IP0 and IP1 are not in the register selection order, though there are some cases where they must be allocated. See #14607. So we may see them as free when looking for a register to spill.
Also, V15 was missing from the selection order (V16 was in the order twice).

Fix #14626
  • Loading branch information
CarolEidt authored and Victor "Nate" Graf committed Nov 7, 2017
1 parent 3bbab41 commit c22532e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/jit/lsra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6149,8 +6149,15 @@ bool LinearScan::isSpillCandidate(Interval* current,
#endif
{
RefPosition* nextPhysRegPosition = physRegRecord->getNextRefPosition();
assert((nextPhysRegPosition->nodeLocation == refLocation && candidateBit != refPosition->registerAssignment)
ARM64_ONLY(|| (physRegRecord->regNum == REG_IP0) || (physRegRecord->regNum == REG_IP1)));
#ifdef _TARGET_ARM64_
// On ARM64, we may need to actually allocate IP0 and IP1 in some cases, but we don't include it in
// the allocation order for tryAllocateFreeReg.
if ((physRegRecord->regNum != REG_IP0) && (physRegRecord->regNum != REG_IP1))
#endif // _TARGET_ARM64_
{
assert((nextPhysRegPosition != nullptr) && (nextPhysRegPosition->nodeLocation == refLocation) &&
(candidateBit != refPosition->registerAssignment));
}
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/jit/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ typedef unsigned short regPairNoSmall; // arm: need 12 bits
REG_V28, REG_V29, REG_V30, REG_V31, \
REG_V7, REG_V6, REG_V5, REG_V4, \
REG_V8, REG_V9, REG_V10, REG_V11, \
REG_V12, REG_V13, REG_V14, REG_V16, \
REG_V12, REG_V13, REG_V14, REG_V15, \
REG_V3, REG_V2, REG_V1, REG_V0

#define REG_CALLEE_SAVED_ORDER REG_R19,REG_R20,REG_R21,REG_R22,REG_R23,REG_R24,REG_R25,REG_R26,REG_R27,REG_R28
Expand Down

0 comments on commit c22532e

Please sign in to comment.