From 1b9ad472a46c0ee589fc5aab07f628f45819b426 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 19 Nov 2008 06:15:35 +0000 Subject: Discard unused runtime function declarations (for readability). llvm-svn: 59594 --- clang/lib/CodeGen/CodeGenModule.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 3e146215f487..dd46f91d743a 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -72,6 +72,12 @@ void CodeGenModule::BindRuntimeFunctions() { llvm::Function *Fn = RuntimeFunctions[i].first; const std::string &Name = RuntimeFunctions[i].second; + // Discard unused runtime functions. + if (Fn->use_empty()) { + Fn->eraseFromParent(); + continue; + } + // See if there is a conflict against a function. llvm::Function *Conflict = TheModule.getFunction(Name); if (Conflict) { -- cgit v1.2.3