Skip to content

Commit

Permalink
BitcodeWriter: Remove redundant (and incorrect) check for whether to …
Browse files Browse the repository at this point in the history
…emit module summary.

The function name Module::empty() is slightly misleading in that it
only tests for the presence of functions in the module. However we
still want to emit the module summary if the module contains only
global variables or aliases. The presence of such entities can be
determined simply by checking the summary directly, as we are doing
below.

Differential Revision: http://reviews.llvm.org/D21669

llvm-svn: 273638
  • Loading branch information
pcc committed Jun 24, 2016
1 parent d9c39fc commit b19924a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 0 additions & 3 deletions llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Expand Up @@ -3271,9 +3271,6 @@ static const uint64_t INDEX_VERSION = 1;
/// 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;

Expand Down
5 changes: 5 additions & 0 deletions llvm/test/Bitcode/thinlto-summary-globalvar.ll
@@ -0,0 +1,5 @@
; RUN: opt -module-summary %s -o - | llvm-bcanalyzer -dump | FileCheck %s

; CHECK: <GLOBALVAL_SUMMARY_BLOCK

@a = global i32 0

0 comments on commit b19924a

Please sign in to comment.