fix asmwriting of ConstantDataArray to use the right element count,

simplify ConstantArray handling, since they can never be empty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149341 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2012-01-31 03:15:40 +00:00
parent c8d75c78ec
commit 8b10b69ba2

View File

@ -837,7 +837,6 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
Out << '"';
} else { // Cannot output in string format...
Out << '[';
if (CA->getNumOperands()) {
TypePrinter.print(ETy, Out);
Out << ' ';
WriteAsOperandInternal(Out, CA->getOperand(0),
@ -850,7 +849,6 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
WriteAsOperandInternal(Out, CA->getOperand(i), &TypePrinter, Machine,
Context);
}
}
Out << ']';
}
return;
@ -868,13 +866,12 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
Type *ETy = CA->getType()->getElementType();
Out << '[';
if (CA->getNumOperands()) {
TypePrinter.print(ETy, Out);
Out << ' ';
WriteAsOperandInternal(Out, CA->getElementAsConstant(0),
&TypePrinter, Machine,
Context);
for (unsigned i = 1, e = CA->getNumOperands(); i != e; ++i) {
for (unsigned i = 1, e = CA->getNumElements(); i != e; ++i) {
Out << ", ";
TypePrinter.print(ETy, Out);
Out << ' ';
@ -882,7 +879,6 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
Machine, Context);
}
Out << ']';
}
return;
}