diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-05-16 13:34:04 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-05-16 13:34:04 +0000 |
| commit | 4fe0094fd15c9b94e4940994cced3e23baafdb9b (patch) | |
| tree | 3a8e76199bad6971294da68811ba0d0edb19678b /llvm/lib/Transforms | |
| parent | 95442c445fa2b5f5b43100ca049dcc6e3b01c0f8 (diff) | |
| download | bcm5719-llvm-4fe0094fd15c9b94e4940994cced3e23baafdb9b.tar.gz bcm5719-llvm-4fe0094fd15c9b94e4940994cced3e23baafdb9b.zip | |
Change the GlobalAlias constructor to look a bit more like GlobalVariable.
This is part of the fix for pr10367. A GlobalAlias always has a pointer type,
so just have the constructor build the type.
llvm-svn: 208983
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/MergeFunctions.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Utils/CloneModule.cpp | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index 59b6c22aa46..a8106e0c32f 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -1328,8 +1328,10 @@ void MergeFunctions::writeThunk(Function *F, Function *G) { // Replace G with an alias to F and delete G. void MergeFunctions::writeAlias(Function *F, Function *G) { Constant *BitcastF = ConstantExpr::getBitCast(F, G->getType()); - GlobalAlias *GA = new GlobalAlias(G->getType(), G->getLinkage(), "", - BitcastF, G->getParent()); + PointerType *PTy = G->getType(); + GlobalAlias *GA = + new GlobalAlias(PTy->getElementType(), G->getLinkage(), "", BitcastF, + G->getParent(), PTy->getAddressSpace()); F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); GA->takeName(G); GA->setVisibility(G->getVisibility()); diff --git a/llvm/lib/Transforms/Utils/CloneModule.cpp b/llvm/lib/Transforms/Utils/CloneModule.cpp index 5d180a5478c..1a3641452d9 100644 --- a/llvm/lib/Transforms/Utils/CloneModule.cpp +++ b/llvm/lib/Transforms/Utils/CloneModule.cpp @@ -67,8 +67,10 @@ Module *llvm::CloneModule(const Module *M, ValueToValueMapTy &VMap) { // Loop over the aliases in the module for (Module::const_alias_iterator I = M->alias_begin(), E = M->alias_end(); I != E; ++I) { - GlobalAlias *GA = new GlobalAlias(I->getType(), I->getLinkage(), - I->getName(), nullptr, New); + auto *PTy = cast<PointerType>(I->getType()); + auto *GA = + new GlobalAlias(PTy->getElementType(), I->getLinkage(), I->getName(), + nullptr, New, PTy->getAddressSpace()); GA->copyAttributesFrom(I); VMap[I] = GA; } |

