[llvm] r273638 - BitcodeWriter: Remove redundant (and incorrect) check for whether to emit module summary.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 23 18:58:03 PDT 2016


Author: pcc
Date: Thu Jun 23 20:58:02 2016
New Revision: 273638

URL: http://llvm.org/viewvc/llvm-project?rev=273638&view=rev
Log:
BitcodeWriter: Remove redundant (and incorrect) check for whether to 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

Added:
    llvm/trunk/test/Bitcode/thinlto-summary-globalvar.ll
Modified:
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=273638&r1=273637&r2=273638&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Thu Jun 23 20:58:02 2016
@@ -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;
 

Added: llvm/trunk/test/Bitcode/thinlto-summary-globalvar.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/thinlto-summary-globalvar.ll?rev=273638&view=auto
==============================================================================
--- llvm/trunk/test/Bitcode/thinlto-summary-globalvar.ll (added)
+++ llvm/trunk/test/Bitcode/thinlto-summary-globalvar.ll Thu Jun 23 20:58:02 2016
@@ -0,0 +1,5 @@
+; RUN: opt -module-summary %s -o - | llvm-bcanalyzer -dump | FileCheck %s
+
+; CHECK: <GLOBALVAL_SUMMARY_BLOCK
+
+ at a = global i32 0




More information about the llvm-commits mailing list