aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/AsmWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r--lib/VMCore/AsmWriter.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 8834e1e2a2..656a7bed74 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -926,7 +926,7 @@ void AssemblyWriter::printAlias(const GlobalAlias *GA) {
assert(0 && "Invalid alias linkage");
}
- const GlobalValue *Aliasee = GA->getAliasee();
+ const Constant *Aliasee = dyn_cast_or_null<Constant>(GA->getAliasee());
assert(Aliasee && "Aliasee cannot be null");
if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Aliasee)) {
@@ -940,9 +940,15 @@ void AssemblyWriter::printAlias(const GlobalAlias *GA) {
Out << getLLVMName(F->getName(), GlobalPrefix);
else
Out << "@\"\"";
- } else
- assert(0 && "Unsupported aliasee");
-
+ } else {
+ const ConstantExpr *CE = 0;
+ if ((CE = dyn_cast<ConstantExpr>(Aliasee)) &&
+ (CE->getOpcode() == Instruction::BitCast)) {
+ writeOperand(CE, false);
+ } else
+ assert(0 && "Unsupported aliasee");
+ }
+
printInfoComment(*GA);
Out << "\n";
}