[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Jun 6 02:11:02 PDT 2003


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.91 -> 1.92

---
Log message:

Don't output explicit initializers for globals that are zero initialized


---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.91 llvm/lib/CWriter/Writer.cpp:1.92
--- llvm/lib/CWriter/Writer.cpp:1.91	Sun Jun  1 22:10:53 2003
+++ llvm/lib/CWriter/Writer.cpp	Fri Jun  6 02:10:24 2003
@@ -73,7 +73,6 @@
     void printModule(Module *M);
     void printSymbolTable(const SymbolTable &ST);
     void printContainedStructs(const Type *Ty, std::set<const StructType *> &);
-    void printGlobal(const GlobalVariable *GV);
     void printFunctionSignature(const Function *F, bool Prototype);
 
     void printFunction(Function *);
@@ -619,9 +618,10 @@
         if (I->hasInternalLinkage())
           Out << "static ";
         printType(Out, I->getType()->getElementType(), getValueName(I));
-      
-        Out << " = " ;
-        writeOperand(I->getInitializer());
+        if (!I->getInitializer()->isNullValue()) {
+          Out << " = " ;
+          writeOperand(I->getInitializer());
+        }
         Out << ";\n";
       }
   }





More information about the llvm-commits mailing list