summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/CloneModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneModule.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CloneModule.cpp6
1 files changed, 4 insertions, 2 deletions
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;
}
OpenPOWER on IntegriCloud