[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Jun 28 15:09:01 PDT 2003


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.89 -> 1.90

---
Log message:

Avoid printing out huge structures or arrays if they are just filled with zeros


---
Diffs of the changes:

Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.89 llvm/lib/VMCore/AsmWriter.cpp:1.90
--- llvm/lib/VMCore/AsmWriter.cpp:1.89	Tue Jun 17 18:55:35 2003
+++ llvm/lib/VMCore/AsmWriter.cpp	Sat Jun 28 15:08:24 2003
@@ -253,6 +253,11 @@
     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 @@
       Out << " ]";
     }
   } else if (const ConstantStruct *CS = dyn_cast<ConstantStruct>(CV)) {
+    if (CS->getNumOperands() > 5 && CS->isNullValue()) {
+      Out << "zeroinitializer";
+      return;
+    }
+
     Out << "{";
     if (CS->getNumOperands()) {
       Out << " ";





More information about the llvm-commits mailing list