diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 954266163b1..39e09fb40f3 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -73,7 +73,6 @@ namespace { void printModule(Module *M); void printSymbolTable(const SymbolTable &ST); void printContainedStructs(const Type *Ty, std::set &); - void printGlobal(const GlobalVariable *GV); void printFunctionSignature(const Function *F, bool Prototype); void printFunction(Function *); @@ -619,9 +618,10 @@ void CWriter::printModule(Module *M) { 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"; } } diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 954266163b1..39e09fb40f3 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -73,7 +73,6 @@ namespace { void printModule(Module *M); void printSymbolTable(const SymbolTable &ST); void printContainedStructs(const Type *Ty, std::set &); - void printGlobal(const GlobalVariable *GV); void printFunctionSignature(const Function *F, bool Prototype); void printFunction(Function *); @@ -619,9 +618,10 @@ void CWriter::printModule(Module *M) { 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"; } }