diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2015-03-16 23:36:24 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2015-03-16 23:36:24 +0000 |
commit | ad0bdcd2380a09c7dac5ef9748fc20d9cba3e319 (patch) | |
tree | 986394a1f69a94f3f8b389979c67267713d43919 /llvm/lib | |
parent | 3b36038f45f9eef50fb3fbbdac1fd4eb47b6c4ca (diff) | |
download | bcm5719-llvm-ad0bdcd2380a09c7dac5ef9748fc20d9cba3e319.tar.gz bcm5719-llvm-ad0bdcd2380a09c7dac5ef9748fc20d9cba3e319.zip |
LowerBitSets: do not use private aliases at all on Darwin.
LLVM currently turns these into linker-private symbols, which can be dead
stripped by the Darwin linker.
llvm-svn: 232435
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/IPO/LowerBitSets.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/IPO/LowerBitSets.cpp b/llvm/lib/Transforms/IPO/LowerBitSets.cpp index 8602642103c..9c1fc33c310 100644 --- a/llvm/lib/Transforms/IPO/LowerBitSets.cpp +++ b/llvm/lib/Transforms/IPO/LowerBitSets.cpp @@ -349,9 +349,13 @@ void LowerBitSets::allocateByteArrays() { // Create an alias instead of RAUW'ing the gep directly. On x86 this ensures // that the pc-relative displacement is folded into the lea instead of the // test instruction getting another displacement. - GlobalAlias *Alias = GlobalAlias::create( - Int8Ty, 0, GlobalValue::PrivateLinkage, "bits", GEP, M); - BAI->ByteArray->replaceAllUsesWith(Alias); + if (LinkerSubsectionsViaSymbols) { + BAI->ByteArray->replaceAllUsesWith(GEP); + } else { + GlobalAlias *Alias = GlobalAlias::create( + Int8Ty, 0, GlobalValue::PrivateLinkage, "bits", GEP, M); + BAI->ByteArray->replaceAllUsesWith(Alias); + } BAI->ByteArray->eraseFromParent(); } @@ -529,15 +533,16 @@ void LowerBitSets::buildBitSetsFromGlobals( ConstantInt::get(Int32Ty, I * 2)}; Constant *CombinedGlobalElemPtr = ConstantExpr::getGetElementPtr(CombinedGlobal, CombinedGlobalIdxs); - GlobalValue::LinkageTypes GAliasLinkage = LinkerSubsectionsViaSymbols - ? GlobalValue::PrivateLinkage - : Globals[I]->getLinkage(); - GlobalAlias *GAlias = GlobalAlias::create( - Globals[I]->getType()->getElementType(), - Globals[I]->getType()->getAddressSpace(), GAliasLinkage, - "", CombinedGlobalElemPtr, M); - GAlias->takeName(Globals[I]); - Globals[I]->replaceAllUsesWith(GAlias); + if (LinkerSubsectionsViaSymbols) { + Globals[I]->replaceAllUsesWith(CombinedGlobalElemPtr); + } else { + GlobalAlias *GAlias = GlobalAlias::create( + Globals[I]->getType()->getElementType(), + Globals[I]->getType()->getAddressSpace(), Globals[I]->getLinkage(), + "", CombinedGlobalElemPtr, M); + GAlias->takeName(Globals[I]); + Globals[I]->replaceAllUsesWith(GAlias); + } Globals[I]->eraseFromParent(); } } |