summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-28 20:08:24 +0000
committerChris Lattner <sabre@nondot.org>2003-06-28 20:08:24 +0000
commite9a64ea38e6701f76d2767d8e467083e8ba35920 (patch)
treebfed6451c9e171fb2f41a1675fb77613671ceefe /lib/VMCore
parentf460048771217932f9098dc8023653eba0c70a7f (diff)
downloadllvm-e9a64ea38e6701f76d2767d8e467083e8ba35920.tar.gz
llvm-e9a64ea38e6701f76d2767d8e467083e8ba35920.tar.bz2
llvm-e9a64ea38e6701f76d2767d8e467083e8ba35920.tar.xz
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
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index afc4b6d63c..a6d6cbe83c 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<ConstantArray>(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<ConstantStruct>(CV)) {
+ if (CS->getNumOperands() > 5 && CS->isNullValue()) {
+ Out << "zeroinitializer";
+ return;
+ }
+
Out << "{";
if (CS->getNumOperands()) {
Out << " ";