summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-11-19 06:15:35 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-11-19 06:15:35 +0000
commit1b9ad472a46c0ee589fc5aab07f628f45819b426 (patch)
tree446802df7f01855686b80b7ed5a4116d25bfb55e /clang/lib/CodeGen/CodeGenModule.cpp
parent8d5bec4c7dd2932396d624c4a73cea98da5da6ab (diff)
downloadbcm5719-llvm-1b9ad472a46c0ee589fc5aab07f628f45819b426.tar.gz
bcm5719-llvm-1b9ad472a46c0ee589fc5aab07f628f45819b426.zip
Discard unused runtime function declarations (for readability).
llvm-svn: 59594
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 3e146215f48..dd46f91d743 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) {
OpenPOWER on IntegriCloud