diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-06-20 17:03:23 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-06-20 17:03:23 +0000 |
| commit | 5dc457cbe459e355988406c28545e45b29c3c43b (patch) | |
| tree | 0e03b16d598478065f11721ff2169b389df46c6d /llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | |
| parent | 68f29dac4be8a9fc31533263c308252934d50a05 (diff) | |
| download | bcm5719-llvm-5dc457cbe459e355988406c28545e45b29c3c43b.tar.gz bcm5719-llvm-5dc457cbe459e355988406c28545e45b29c3c43b.zip | |
AMDGPU: Fix ignoring DisableFramePointerElim in leaf functions
The attribute can specify elimination for leaf or non-leaf, so it
should always be considered. I copied this bug from AArch64, which
probably should also be fixed.
llvm-svn: 363949
Diffstat (limited to 'llvm/lib/Target/AMDGPU/SIFrameLowering.cpp')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp index ca2fcfa036f..11d41775421 100644 --- a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp @@ -707,12 +707,12 @@ void SIFrameLowering::emitEpilogue(MachineFunction &MF, .addReg(ScratchExecCopy); } - if (hasFP(MF)) { - const MachineFrameInfo &MFI = MF.getFrameInfo(); - uint32_t NumBytes = MFI.getStackSize(); - uint32_t RoundedSize = FuncInfo->isStackRealigned() ? - NumBytes + MFI.getMaxAlignment() : NumBytes; + const MachineFrameInfo &MFI = MF.getFrameInfo(); + uint32_t NumBytes = MFI.getStackSize(); + uint32_t RoundedSize = FuncInfo->isStackRealigned() ? + NumBytes + MFI.getMaxAlignment() : NumBytes; + if (RoundedSize != 0 && hasFP(MF)) { const unsigned StackPtrReg = FuncInfo->getStackPtrOffsetReg(); BuildMI(MBB, MBBI, DL, TII->get(AMDGPU::S_SUB_U32), StackPtrReg) .addReg(StackPtrReg) @@ -863,14 +863,10 @@ bool SIFrameLowering::hasFP(const MachineFunction &MF) const { // API SP if there are calls. if (MF.getInfo<SIMachineFunctionInfo>()->isEntryFunction()) return true; - - // Retain behavior of always omitting the FP for leaf functions when - // possible. - if (MF.getTarget().Options.DisableFramePointerElim(MF)) - return true; } return MFI.hasVarSizedObjects() || MFI.isFrameAddressTaken() || MFI.hasStackMap() || MFI.hasPatchPoint() || - MF.getSubtarget<GCNSubtarget>().getRegisterInfo()->needsStackRealignment(MF); + MF.getSubtarget<GCNSubtarget>().getRegisterInfo()->needsStackRealignment(MF) || + MF.getTarget().Options.DisableFramePointerElim(MF); } |

