llvm/test/LTO/runtime-library.ll
Justin Bogner dc6b4b4fc2 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>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194514 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-12 21:44:01 +00:00

28 lines
487 B
LLVM

; 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
}