Protect user-supplied runtime library functions in LTO
authorJustin Bogner <mail@justinbogner.com>
Tue, 12 Nov 2013 21:44:01 +0000 (21:44 +0000)
committerJustin Bogner <mail@justinbogner.com>
Tue, 12 Nov 2013 21:44:01 +0000 (21:44 +0000)
commitdc6b4b4fc2665eea17684d29e4dae219b258b5ef
tree3098f3760218f627a65eb20fe6b2935d088dfe63
parent59e648e3c8966e0678902a2994558f25c8573ce4
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
include/llvm/LTO/LTOCodeGenerator.h
lib/LTO/LTOCodeGenerator.cpp
test/LTO/runtime-library.ll [new file with mode: 0644]