don't send null pointers through the constantexpr codepath unneededly.

llvm-svn: 94010
This commit is contained in:
Chris Lattner 2010-01-20 17:57:50 +00:00
parent 6a89c50e23
commit c47ece59a8
1 changed files with 6 additions and 0 deletions

View File

@ -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())) {