From dc6b4b4fc2665eea17684d29e4dae219b258b5ef Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Tue, 12 Nov 2013 21:44:01 +0000 Subject: 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194514 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/LTO/LTOCodeGenerator.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/llvm/LTO') diff --git a/include/llvm/LTO/LTOCodeGenerator.h b/include/llvm/LTO/LTOCodeGenerator.h index 97a5066339..c478bd980d 100644 --- a/include/llvm/LTO/LTOCodeGenerator.h +++ b/include/llvm/LTO/LTOCodeGenerator.h @@ -38,6 +38,7 @@ #include "llvm-c/lto.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/Linker.h" #include "llvm/Target/TargetOptions.h" #include @@ -48,6 +49,7 @@ namespace llvm { class GlobalValue; class Mangler; class MemoryBuffer; + class TargetLibraryInfo; class TargetMachine; class raw_ostream; } @@ -125,6 +127,7 @@ private: std::string &errMsg); void applyScopeRestrictions(); void applyRestriction(llvm::GlobalValue &GV, + const llvm::ArrayRef &Libcalls, std::vector &MustPreserveList, llvm::SmallPtrSet &AsmUsed, llvm::Mangler &Mangler); -- cgit v1.2.3