summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-05-03 23:13:42 +0000
committerReid Kleckner <rnk@google.com>2017-05-03 23:13:42 +0000
commit5c0bdef5aa25e67daf5804cf3b8bbc16c09bb97c (patch)
tree913f8bfe3224f40341d2c1b4a0c6c2f303bd2d20
parent8189a87a1ed98a4f3fc3966e52ebad984f18f262 (diff)
downloadbcm5719-llvm-5c0bdef5aa25e67daf5804cf3b8bbc16c09bb97c.tar.gz
bcm5719-llvm-5c0bdef5aa25e67daf5804cf3b8bbc16c09bb97c.zip
Mark functions as not having CFI once we finalize an x86 stack frame
We'll set it back to true in emitPrologue if it gets called. It doesn't get called for naked functions. Fixes PR32912 llvm-svn: 302092
-rw-r--r--llvm/lib/Target/X86/X86FrameLowering.cpp4
-rw-r--r--llvm/test/CodeGen/X86/win64_eh_leaf.ll9
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index a94045cd536..331e56976db 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -2990,6 +2990,10 @@ unsigned X86FrameLowering::getWinEHParentFrameOffset(const MachineFunction &MF)
void X86FrameLowering::processFunctionBeforeFrameFinalized(
MachineFunction &MF, RegScavenger *RS) const {
+ // Mark the function as not having WinCFI. We will set it back to true in
+ // emitPrologue if it gets called and emits CFI.
+ MF.setHasWinCFI(false);
+
// If this function isn't doing Win64-style C++ EH, we don't need to do
// anything.
const Function *Fn = MF.getFunction();
diff --git a/llvm/test/CodeGen/X86/win64_eh_leaf.ll b/llvm/test/CodeGen/X86/win64_eh_leaf.ll
index 21a423ab36a..35d55a90737 100644
--- a/llvm/test/CodeGen/X86/win64_eh_leaf.ll
+++ b/llvm/test/CodeGen/X86/win64_eh_leaf.ll
@@ -29,3 +29,12 @@ entry:
; and no unwind info in the object file.
; READOBJ-NOT: leaf_func
}
+
+define void @naked_func() naked {
+ call void asm sideeffect "ret", ""()
+ unreachable
+}
+; ASM-LABEL: naked_func:
+; ASM-NOT: .seh_
+; ASM: ret
+; ASM-NOT: .seh_
OpenPOWER on IntegriCloud