Fix printing of Alloca instructions with null operands.
authorDan Gohman <gohman@apple.com>
Fri, 31 Jul 2009 18:23:24 +0000 (18:23 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 31 Jul 2009 18:23:24 +0000 (18:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77697 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AsmWriter.cpp

index 8824fd9244f915673ed85c4e019fd6217183e1bc..8358c5d84c478e9bd75c97d87793aed8dfadd27c 100644 (file)
@@ -1915,7 +1915,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
   } else if (const AllocationInst *AI = dyn_cast<AllocationInst>(&I)) {
     Out << ' ';
     TypePrinter.print(AI->getType()->getElementType(), Out);
-    if (AI->isArrayAllocation()) {
+    if (!AI->getArraySize() || AI->isArrayAllocation()) {
       Out << ", ";
       writeOperand(AI->getArraySize(), true);
     }