summaryrefslogtreecommitdiff
path: root/lib/VMCore/AsmWriter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-25 21:23:19 +0000
committerChris Lattner <sabre@nondot.org>2009-04-25 21:23:19 +0000
commita2165ed6ee7f73b5cf272a0b5d5d4ed448f52665 (patch)
treeee38733ad0a5bc78bba880056bc7630c8110636a /lib/VMCore/AsmWriter.cpp
parent4f4365eb4ec0e1e84a48dbc5bb9f323018facec7 (diff)
downloadllvm-a2165ed6ee7f73b5cf272a0b5d5d4ed448f52665.tar.gz
llvm-a2165ed6ee7f73b5cf272a0b5d5d4ed448f52665.tar.bz2
llvm-a2165ed6ee7f73b5cf272a0b5d5d4ed448f52665.tar.xz
Allow aliasee to be a GEP or bitcast instead of just a bitcast.
The real fix for this whole mess is to require the operand of the alias to be a *GlobalValue* (not a general constant, including constant exprs) but allow the operand and the alias type to be unrelated. This fixes PR4066 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70079 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r--lib/VMCore/AsmWriter.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index f007c7645c..742931e8fd 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -1317,12 +1317,12 @@ void AssemblyWriter::printAlias(const GlobalAlias *GA) {
Out << ' ';
PrintLLVMName(Out, GA);
} else {
- const ConstantExpr *CE = 0;
- if ((CE = dyn_cast<ConstantExpr>(Aliasee)) &&
- (CE->getOpcode() == Instruction::BitCast)) {
- writeOperand(CE, false);
- } else
- assert(0 && "Unsupported aliasee");
+ const ConstantExpr *CE = cast<ConstantExpr>(Aliasee);
+ // The only valid GEP is an all zero GEP.
+ assert((CE->getOpcode() == Instruction::BitCast ||
+ CE->getOpcode() == Instruction::GetElementPtr) &&
+ "Unsupported aliasee");
+ writeOperand(CE, false);
}
printInfoComment(*GA);