[PATCH] D32822: Win64: set HasWinCFI for naked functions
Tim Neumann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 3 12:05:12 PDT 2017
TimNN created this revision.
Fixes https://bugs.llvm.org/show_bug.cgi?id=32912.
`HasWinCFI` is normally set during prolog insertion, since that doesn't happen for naked functions it remains unset for those which causes assertion errors later.
https://reviews.llvm.org/D32822
Files:
lib/CodeGen/PrologEpilogInserter.cpp
test/CodeGen/X86/naked-win-x86_64.ll
Index: test/CodeGen/X86/naked-win-x86_64.ll
===================================================================
--- /dev/null
+++ test/CodeGen/X86/naked-win-x86_64.ll
@@ -0,0 +1,9 @@
+; RUN: llc < %s
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+define internal void @naked_fn() naked {
+start:
+ ret void
+}
Index: lib/CodeGen/PrologEpilogInserter.cpp
===================================================================
--- lib/CodeGen/PrologEpilogInserter.cpp
+++ lib/CodeGen/PrologEpilogInserter.cpp
@@ -210,6 +210,11 @@
// and MaxCallFrameSize variables.
if (!F->hasFnAttribute(Attribute::Naked))
insertPrologEpilogCode(Fn);
+ else
+ // Normally HasWinCFI would be set sometime during prolog insertion, since
+ // that doesn't happen insert it here since later code depends on it being
+ // set.
+ Fn.setHasWinCFI(false);
// Replace all MO_FrameIndex operands with physical register references
// and actual offsets.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32822.97702.patch
Type: text/x-patch
Size: 1016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170503/066b0ae4/attachment.bin>
More information about the llvm-commits
mailing list