From: Reid Kleckner Date: Wed, 3 May 2017 23:13:42 +0000 (+0000) Subject: Mark functions as not having CFI once we finalize an x86 stack frame X-Git-Tag: llvmorg-5.0.0-rc1~6015 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5c0bdef5aa25e67daf5804cf3b8bbc16c09bb97c;p=platform%2Fupstream%2Fllvm.git 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 --- diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index a94045c..331e569 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 21a423a..35d55a9 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_