Revert "[opaque pointer type] Pass GlobalAlias the actual pointer type rather than...
[oota-llvm.git] / lib / IR / Core.cpp
index 2937a62f3b57d16713b2b29d602487b4ca24fe7b..224132977969c9a6ee0fff6a991fbfd05780b7ef 100644 (file)
@@ -1644,7 +1644,8 @@ void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit) {
 LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
                           const char *Name) {
   auto *PTy = cast<PointerType>(unwrap(Ty));
-  return wrap(GlobalAlias::create(PTy, GlobalValue::ExternalLinkage, Name,
+  return wrap(GlobalAlias::create(PTy->getElementType(), PTy->getAddressSpace(),
+                                  GlobalValue::ExternalLinkage, Name,
                                   unwrap<Constant>(Aliasee), unwrap(M)));
 }