diff options
author | Vitaly Buka <vitalybuka@google.com> | 2018-04-07 05:36:44 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2018-04-07 05:36:44 +0000 |
commit | de5f196530b508df3bc8c035ae1db87b56437d88 (patch) | |
tree | 7f702512cbfb50729ca134d7dadbad1efb364c96 /llvm/lib | |
parent | d1324fdff005fd267630c004760a544dabad8357 (diff) | |
download | bcm5719-llvm-de5f196530b508df3bc8c035ae1db87b56437d88.tar.gz bcm5719-llvm-de5f196530b508df3bc8c035ae1db87b56437d88.zip |
Revert "ARM: Do not spill CSR to stack on entry to noreturn functions"
Breaks ubsan test TestCases/Misc/missing_return.cpp on ARM
This reverts commit r329287
llvm-svn: 329486
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp | 18 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMFrameLowering.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMFrameLowering.h | 2 |
3 files changed, 0 insertions, 31 deletions
diff --git a/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp b/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp index 76c5425b692..79fafa5497f 100644 --- a/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp +++ b/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp @@ -36,12 +36,6 @@ bool TargetFrameLowering::noFramePointerElim(const MachineFunction &MF) const { return Attr.getValueAsString() == "true"; } -bool TargetFrameLowering::enableCalleeSaveSkip(const MachineFunction &MF) const { - assert(MF.getFunction().hasFnAttribute(Attribute::NoReturn) && - MF.getFunction().hasFnAttribute(Attribute::NoUnwind)); - return false; -} - /// Returns the displacement from the frame register to the stack /// frame of the specified index, along with the frame register used /// (in output arg FrameReg). This is the default implementation which @@ -91,18 +85,6 @@ void TargetFrameLowering::determineCalleeSaves(MachineFunction &MF, if (MF.getFunction().hasFnAttribute(Attribute::Naked)) return; - // Noreturn+nounwind functions never restore CSR, so no saves are needed. - // Purely noreturn functions may still return through throws, so those must - // save CSR for caller exception handlers. - // - // If the function uses longjmp to break out of its current path of - // execution we do not need the CSR spills either: setjmp stores all CSRs - // it was called with into the jmp_buf, which longjmp then restores. - if (MF.getFunction().hasFnAttribute(Attribute::NoReturn) && - MF.getFunction().hasFnAttribute(Attribute::NoUnwind) && - enableCalleeSaveSkip(MF)) - return; - // Functions which call __builtin_unwind_init get all their registers saved. bool CallsUnwindInit = MF.callsUnwindInit(); const MachineRegisterInfo &MRI = MF.getRegInfo(); diff --git a/llvm/lib/Target/ARM/ARMFrameLowering.cpp b/llvm/lib/Target/ARM/ARMFrameLowering.cpp index f9d2b606987..5da1e766a9e 100644 --- a/llvm/lib/Target/ARM/ARMFrameLowering.cpp +++ b/llvm/lib/Target/ARM/ARMFrameLowering.cpp @@ -87,17 +87,6 @@ bool ARMFrameLowering::noFramePointerElim(const MachineFunction &MF) const { MF.getSubtarget<ARMSubtarget>().useFastISel(); } -/// Returns true if the target can safely skip saving callee-saved registers -/// for noreturn nounwind functions. -bool ARMFrameLowering::enableCalleeSaveSkip(const MachineFunction &MF) const { - assert(MF.getFunction().hasFnAttribute(Attribute::NoReturn) && - MF.getFunction().hasFnAttribute(Attribute::NoUnwind)); - - // Frame pointer and link register are not treated as normal CSR, thus we - // can always skip CSR saves for nonreturning functions. - return true; -} - /// hasFP - Return true if the specified function should have a dedicated frame /// pointer register. This is true if the function has variable sized allocas /// or if frame pointer elimination is disabled. diff --git a/llvm/lib/Target/ARM/ARMFrameLowering.h b/llvm/lib/Target/ARM/ARMFrameLowering.h index e994cab28fe..1f18e2bf80c 100644 --- a/llvm/lib/Target/ARM/ARMFrameLowering.h +++ b/llvm/lib/Target/ARM/ARMFrameLowering.h @@ -44,8 +44,6 @@ public: bool noFramePointerElim(const MachineFunction &MF) const override; - bool enableCalleeSaveSkip(const MachineFunction &MF) const override; - bool hasFP(const MachineFunction &MF) const override; bool hasReservedCallFrame(const MachineFunction &MF) const override; bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override; |