From e9a64ea38e6701f76d2767d8e467083e8ba35920 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 28 Jun 2003 20:08:24 +0000 Subject: [PATCH] Avoid printing out huge structures or arrays if they are just filled with zeros git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6938 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/AsmWriter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index afc4b6d63c6..a6d6cbe83c3 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -253,6 +253,11 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV, Out << "0x" << utohexstr(*(uint64_t*)Ptr); } else if (const ConstantArray *CA = dyn_cast(CV)) { + if (CA->getNumOperands() > 5 && CA->isNullValue()) { + Out << "zeroinitializer"; + return; + } + // As a special case, print the array as a string if it is an array of // ubytes or an array of sbytes with positive values. // @@ -300,6 +305,11 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV, Out << " ]"; } } else if (const ConstantStruct *CS = dyn_cast(CV)) { + if (CS->getNumOperands() > 5 && CS->isNullValue()) { + Out << "zeroinitializer"; + return; + } + Out << "{"; if (CS->getNumOperands()) { Out << " ";