Index: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp =================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -3271,9 +3271,6 @@ /// Emit the per-module summary section alongside the rest of /// the module's bitcode. void ModuleBitcodeWriter::writePerModuleGlobalValueSummary() { - if (M.empty()) - return; - if (Index->begin() == Index->end()) return; Index: llvm/trunk/test/Bitcode/thinlto-summary-globalvar.ll =================================================================== --- llvm/trunk/test/Bitcode/thinlto-summary-globalvar.ll +++ llvm/trunk/test/Bitcode/thinlto-summary-globalvar.ll @@ -0,0 +1,5 @@ +; RUN: opt -module-summary %s -o - | llvm-bcanalyzer -dump | FileCheck %s + +; CHECK: