[llvm] r302092 - Mark functions as not having CFI once we finalize an x86 stack frame

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 16:13:42 PDT 2017


Author: rnk
Date: Wed May  3 18:13:42 2017
New Revision: 302092

URL: http://llvm.org/viewvc/llvm-project?rev=302092&view=rev
Log:
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

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

Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=302092&r1=302091&r2=302092&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Wed May  3 18:13:42 2017
@@ -2990,6 +2990,10 @@ unsigned X86FrameLowering::getWinEHParen
 
 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();

Modified: llvm/trunk/test/CodeGen/X86/win64_eh_leaf.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/win64_eh_leaf.ll?rev=302092&r1=302091&r2=302092&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/win64_eh_leaf.ll (original)
+++ llvm/trunk/test/CodeGen/X86/win64_eh_leaf.ll Wed May  3 18:13:42 2017
@@ -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_




More information about the llvm-commits mailing list