[PATCH] D21669: BitcodeWriter: Remove redundant (and incorrect) check for whether to emit module summary.

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 23 18:59:19 PDT 2016


LGTM

Thanks, that's indeed misleading. But probably coherent with Module::begin /end...


> On Jun 23, 2016, at 8:57 PM, Peter Collingbourne <peter at pcc.me.uk> wrote:
> 
> 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;
> 
> 
> 
> <D21669.61748.patch>


More information about the llvm-commits mailing list