summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-11-05 21:37:29 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-11-05 21:37:29 +0000
commit2e2995bf506c4f971f20235f59e0ceed45b77770 (patch)
tree35796044b19f64d3d777266f06e39546d3fef968 /clang/lib/CodeGen/CodeGenModule.cpp
parentf02287db274d955bf4198c6ee10b67e6ebf3985a (diff)
downloadbcm5719-llvm-2e2995bf506c4f971f20235f59e0ceed45b77770.tar.gz
bcm5719-llvm-2e2995bf506c4f971f20235f59e0ceed45b77770.zip
Produce direct calls instead of alias to linkonce_odr functions.
This is a small optimization on linux, but should help more on windows where msvc only outputs one destructor if there would be two identical ones. llvm-svn: 194095
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index c34f8332699..d7f33c9f1e5 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -172,6 +172,20 @@ void CodeGenModule::createCUDARuntime() {
CUDARuntime = CreateNVCUDARuntime(*this);
}
+void CodeGenModule::applyReplacements() {
+ for (ReplacementsTy::iterator I = Replacements.begin(),
+ E = Replacements.end();
+ I != E; ++I) {
+ StringRef MangledName = I->first();
+ llvm::Constant *Replacement = I->second;
+ llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
+ if (!Entry)
+ continue;
+ Entry->replaceAllUsesWith(Replacement);
+ Entry->eraseFromParent();
+ }
+}
+
void CodeGenModule::checkAliases() {
bool Error = false;
for (std::vector<GlobalDecl>::iterator I = Aliases.begin(),
@@ -207,6 +221,7 @@ void CodeGenModule::checkAliases() {
void CodeGenModule::Release() {
EmitDeferred();
+ applyReplacements();
checkAliases();
EmitCXXGlobalInitFunc();
EmitCXXGlobalDtorFunc();
OpenPOWER on IntegriCloud