Mark functions as not having CFI once we finalize an x86 stack frame
authorReid Kleckner <rnk@google.com>
Wed, 3 May 2017 23:13:42 +0000 (23:13 +0000)
committerReid Kleckner <rnk@google.com>
Wed, 3 May 2017 23:13:42 +0000 (23:13 +0000)
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

llvm/lib/Target/X86/X86FrameLowering.cpp
llvm/test/CodeGen/X86/win64_eh_leaf.ll

index a94045c..331e569 100644 (file)
@@ -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();
index 21a423a..35d55a9 100644 (file)
@@ -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_