[PATCH] D21669: 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 17:57:38 PDT 2016


pcc created this revision.
pcc added reviewers: tejohnson, mehdi_amini.
pcc added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.

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.

http://reviews.llvm.org/D21669

Files:
  lib/Bitcode/Writer/BitcodeWriter.cpp
  test/Bitcode/thinlto-summary-globalvar.ll

Index: test/Bitcode/thinlto-summary-globalvar.ll
===================================================================
--- /dev/null
+++ 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
+
+ at a = global i32 0
Index: lib/Bitcode/Writer/BitcodeWriter.cpp
===================================================================
--- lib/Bitcode/Writer/BitcodeWriter.cpp
+++ 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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21669.61748.patch
Type: text/x-patch
Size: 783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160624/6f6d319e/attachment.bin>


More information about the llvm-commits mailing list