aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-20 17:57:50 +0000
committerChris Lattner <sabre@nondot.org>2010-01-20 17:57:50 +0000
commitb0bedd6ebbbf0b9791291f37da5666dd456cf5b1 (patch)
tree0276c9041fe67f6c0e64bd06171afeaf14342240
parentf958dd2e1c12b70f6eef5a2aef4a6ac497a1b471 (diff)
don't send null pointers through the constantexpr codepath unneededly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94010 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 4c5e079f03..32e9036af9 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/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())) {