diff options
| author | Justin Bogner <mail@justinbogner.com> | 2013-11-12 21:44:01 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2013-11-12 21:44:01 +0000 |
| commit | b10a520c8feed63e3d5f6f314a601de9a6b8b123 (patch) | |
| tree | 17de715440b738c7a39f5de25989e0f462c16390 /llvm/test | |
| parent | 87bb4920e9a121e437d3d9abf8426706bdaec6ca (diff) | |
| download | bcm5719-llvm-b10a520c8feed63e3d5f6f314a601de9a6b8b123.tar.gz bcm5719-llvm-b10a520c8feed63e3d5f6f314a601de9a6b8b123.zip | |
Protect user-supplied runtime library functions in LTO
Add user-supplied C runtime and compiler-rt library functions to
llvm.compiler.used to protect them from premature optimization by
passes like -globalopt and -ipsccp. Calls to (seemingly unused)
runtime library functions can be added by -instcombine and instruction
lowering.
Patch by Duncan Exon Smith, thanks!
Fixes <rdar://problem/14740087>
llvm-svn: 194514
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/LTO/runtime-library.ll | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/LTO/runtime-library.ll b/llvm/test/LTO/runtime-library.ll new file mode 100644 index 00000000000..76fc6f0cc47 --- /dev/null +++ b/llvm/test/LTO/runtime-library.ll @@ -0,0 +1,27 @@ +; runtime library implementations should be added to llvm.compiler.used +; RUN: llvm-as <%s >%t1 +; RUN: llvm-lto -o %t2 %t1 +; RUN: llvm-nm -no-sort %t2 | FileCheck %s -check-prefix=KEEP -check-prefix=LOSE + +target triple = "x86_64-apple-darwin9" + +; KEEP-LABEL: _puts +define void @puts() { + ret void +} + +; KEEP-LABEL: ___divti3 +define void @__divti3() { + ret void +} + +; KEEP-LABEL: _memset +define void @memset() { + ret void +} + +; LOSE-NOT: _myprintf +define void @myprintf() { + ret void +} + |

