Revert "[opaque pointer type] Pass GlobalAlias the actual pointer type rather than...
[oota-llvm.git] / lib / Linker / LinkModules.cpp
index 9d5e0b475d8b2a470316aa9bf98c639218d6cda3..4b676cdf9dcd430505ae098d6816d59295e75756 100644 (file)
@@ -586,7 +586,8 @@ static GlobalAlias *copyGlobalAliasProto(TypeMapTy &TypeMap, Module &DstM,
   // If there is no linkage to be performed or we're linking from the source,
   // bring over SGA.
   auto *PTy = cast<PointerType>(TypeMap.get(SGA->getType()));
-  return GlobalAlias::create(PTy, SGA->getLinkage(), SGA->getName(), &DstM);
+  return GlobalAlias::create(PTy->getElementType(), PTy->getAddressSpace(),
+                             SGA->getLinkage(), SGA->getName(), &DstM);
 }
 
 static GlobalValue *copyGlobalValueProto(TypeMapTy &TypeMap, Module &DstM,