summaryrefslogtreecommitdiff
path: root/lib/IR/AsmWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IR/AsmWriter.cpp')
-rw-r--r--lib/IR/AsmWriter.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/IR/AsmWriter.cpp b/lib/IR/AsmWriter.cpp
index 3cbb1d1049..0fef0d0a18 100644
--- a/lib/IR/AsmWriter.cpp
+++ b/lib/IR/AsmWriter.cpp
@@ -1493,10 +1493,16 @@ void AssemblyWriter::printAlias(const GlobalAlias *GA) {
PrintLinkage(GA->getLinkage(), Out);
+ PointerType *Ty = GA->getType();
const Constant *Aliasee = GA->getAliasee();
+ if (!Aliasee || Ty != Aliasee->getType()) {
+ if (unsigned AddressSpace = Ty->getAddressSpace())
+ Out << "addrspace(" << AddressSpace << ") ";
+ TypePrinter.print(Ty->getElementType(), Out);
+ Out << ", ";
+ }
if (!Aliasee) {
- TypePrinter.print(GA->getType(), Out);
Out << " <<NULL ALIASEE>>";
} else {
writeOperand(Aliasee, !isa<ConstantExpr>(Aliasee));