diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-20 17:57:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-20 17:57:50 +0000 |
commit | c47ece59a8c41aaa9d52164b3129688ae91c9e0d (patch) | |
tree | 562ef19ca6abb6146f705fd6adb1d8a50b320c67 /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | 6a89c50e23f21af0da4b3c961bfba2f7192c49c4 (diff) | |
download | bcm5719-llvm-c47ece59a8c41aaa9d52164b3129688ae91c9e0d.tar.gz bcm5719-llvm-c47ece59a8c41aaa9d52164b3129688ae91c9e0d.zip |
don't send null pointers through the constantexpr codepath unneededly.
llvm-svn: 94010
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 4c5e079f03b..32e9036af94 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1247,6 +1247,12 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) { if (const ConstantVector *V = dyn_cast<ConstantVector>(CV)) return EmitGlobalConstantVector(V, AddrSpace, *this); + if (isa<ConstantPointerNull>(CV)) { + unsigned Size = TM.getTargetData()->getTypeAllocSize(CV->getType()); + OutStreamer.EmitIntValue(0, Size, AddrSpace); + return; + } + // Otherwise, it must be a ConstantExpr. Emit the data directive, then emit // the expression value. switch (TM.getTargetData()->getTypeAllocSize(CV->getType())) { |