summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCXX.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-11-08 22:59:46 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-11-08 22:59:46 +0000
commite2ec6faa3621725066c9f9c3e9bd085c680d5167 (patch)
tree31f6cd08607cd889d547bbc463c4d99e5c436ed8 /clang/lib/CodeGen/CGCXX.cpp
parent60dccf2d0622803c4e3ed985517775d9112c8304 (diff)
downloadbcm5719-llvm-e2ec6faa3621725066c9f9c3e9bd085c680d5167.tar.gz
bcm5719-llvm-e2ec6faa3621725066c9f9c3e9bd085c680d5167.zip
If a linkonce_odr dtor/ctor is identical to another one, just rauw.
Unlike an alias a rauw is always safe, so we don't need to avoid this optimization when the replacement is not know to be available in every TU. llvm-svn: 194288
Diffstat (limited to 'clang/lib/CodeGen/CGCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGCXX.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp
index eeedaf10643..8c7a089460f 100644
--- a/clang/lib/CodeGen/CGCXX.cpp
+++ b/clang/lib/CodeGen/CGCXX.cpp
@@ -139,6 +139,13 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl,
if (Ref->getType() != AliasType)
Aliasee = llvm::ConstantExpr::getBitCast(Ref, AliasType);
+ // Instead of creating as alias to a linkonce_odr, replace all of the uses
+ // of the aliassee.
+ if (Linkage == llvm::GlobalValue::LinkOnceODRLinkage) {
+ Replacements[MangledName] = Aliasee;
+ return false;
+ }
+
// Don't create an alias to a linker weak symbol unless we know we can do
// that in every TU. This avoids producing different COMDATs in different
// TUs.
@@ -146,12 +153,6 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl,
if (!InEveryTU)
return true;
- // Instead of creating as alias to a linkonce_odr, replace all of the uses
- // of the aliassee.
- if (Linkage == llvm::GlobalValue::LinkOnceODRLinkage) {
- Replacements[MangledName] = Aliasee;
- return false;
- }
assert(Linkage == TargetLinkage);
}
OpenPOWER on IntegriCloud