[AArch64] Fix regression after r329691

In r329691, we would choose FP even if the offset wouldn't fit, just
because the offset is smaller than the one from BP. This made many
accesses through FP need to scavenge a register, which resulted in
slower and bigger code for no good reason.

This patch now always picks the offset that fits first, even if FP is
preferred.

llvm-svn: 329797
This commit is contained in:
Francis Visoiu Mistrih 2018-04-11 12:36:55 +00:00
parent 074ff7c5b6
commit 6463922e3a
1 changed files with 1 additions and 1 deletions

View File

@ -1052,7 +1052,7 @@ int AArch64FrameLowering::resolveFrameIndexReference(const MachineFunction &MF,
// else we can use BP and FP, but the offset from FP won't fit.
// That will make us scavenge registers which we can probably avoid by
// using BP. If it won't fit for BP either, we'll scavenge anyway.
} else if (PreferFP || FPOffset >= 0) {
} else if (FPOffset >= 0) {
// Use SP or FP, whichever gives us the best chance of the offset
// being in range for direct access. If the FPOffset is positive,
// that'll always be best, as the SP will be even further away.