[opaque pointer types] Switch a few cases of getElementType over, since I had them...
[oota-llvm.git] / lib / Linker / LinkModules.cpp
index 4b676cdf9dcd430505ae098d6816d59295e75756..4d939a62f4bb76fac4d530cb58834cf7de8aca7c 100644 (file)
@@ -585,8 +585,8 @@ static GlobalAlias *copyGlobalAliasProto(TypeMapTy &TypeMap, Module &DstM,
                                          const GlobalAlias *SGA) {
   // 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->getElementType(), PTy->getAddressSpace(),
+  auto *Ty = TypeMap.get(SGA->getValueType());
+  return GlobalAlias::create(Ty, SGA->getType()->getPointerAddressSpace(),
                              SGA->getLinkage(), SGA->getName(), &DstM);
 }