diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-04-21 21:48:41 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-04-21 21:48:41 +0000 |
commit | 9b9a5358dd35d63f83a54256aaf44e0c3cffdde2 (patch) | |
tree | 28c4dbdc7d5f57afa287534e4878890cdb5b8a13 /llvm/test/CodeGen/X86/empty-function.ll | |
parent | 5b0887025bbc3ded0a4a65adc34d7a07f76b6c77 (diff) | |
download | bcm5719-llvm-9b9a5358dd35d63f83a54256aaf44e0c3cffdde2.tar.gz bcm5719-llvm-9b9a5358dd35d63f83a54256aaf44e0c3cffdde2.zip |
Re-commit r301040 "X86: Don't emit zero-byte functions on Windows"
In addition to the original commit, tighten the condition for when to
pad empty functions to COFF Windows. This avoids running into problems
when targeting e.g. Win32 AMDGPU, which caused test failures when this
was committed initially.
llvm-svn: 301047
Diffstat (limited to 'llvm/test/CodeGen/X86/empty-function.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/empty-function.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/empty-function.ll b/llvm/test/CodeGen/X86/empty-function.ll new file mode 100644 index 00000000000..92bebd0ab1a --- /dev/null +++ b/llvm/test/CodeGen/X86/empty-function.ll @@ -0,0 +1,22 @@ +; RUN: llc < %s -mtriple=i686-pc-win32 | FileCheck -check-prefix=CHECK -check-prefix=WIN32 %s +; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck -check-prefix=CHECK -check-prefix=WIN64 %s +; RUN: llc < %s -mtriple=i386-linux-gnu | FileCheck -check-prefix=LINUX %s + +target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" +target triple = "i686-pc-windows-msvc18.0.0" + +; Don't emit empty functions on Windows; it can lead to duplicate entries +; (multiple functions sharing the same RVA) in the Guard CF Function Table which +; the kernel refuses to load. + +define void @f() { +entry: + unreachable + +; CHECK-LABEL: f: +; WIN32: nop +; WIN64: ud2 +; LINUX-NOT: nop +; LINUX-NOT: ud2 + +} |