Revert "[opaque pointer type] Pass GlobalAlias the actual pointer type rather than...
[oota-llvm.git] / lib / CodeGen / GlobalMerge.cpp
index 73543cb3de3471bde9e553b651a26093dd1060d9..3d3f354bcdd9e499c85409773d987012113378eb 100644 (file)
@@ -462,7 +462,8 @@ bool GlobalMerge::doMerge(const SmallVectorImpl<GlobalVariable *> &Globals,
       if (Linkage != GlobalValue::InternalLinkage ||
           !TM->getTargetTriple().isOSBinFormatMachO()) {
         auto *PTy = cast<PointerType>(GEP->getType());
-        GlobalAlias::create(PTy, Linkage, Name, GEP, &M);
+        GlobalAlias::create(PTy->getElementType(), PTy->getAddressSpace(),
+                            Linkage, Name, GEP, &M);
       }
 
       NumMerged++;