[llvm] r285433 - [ThinLTO] Use flags from summary when writing variable summary (NFC)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 12:36:00 PDT 2016

Author: tejohnson
Date: Fri Oct 28 14:36:00 2016
New Revision: 285433

URL: http://llvm.org/viewvc/llvm-project?rev=285433&view=rev
[ThinLTO] Use flags from summary when writing variable summary (NFC)

We already read the flags out of the summary when writing the summary
records for functions and aliases, do the same for variables.

This is an NFC change for now since the flags computed on the fly from
the GlobalValue currently will always match those in the summary
already, but once I send a follow-on patch to set the NoRename flag for
locals in the llvm.used set this becomes a necessary change.


Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=285433&r1=285432&r2=285433&view=diff
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Fri Oct 28 14:36:00 2016
@@ -3331,9 +3331,9 @@ void ModuleBitcodeWriter::writeModuleLev
   if (V.isDeclaration())
-  NameVals.push_back(getEncodedGVSummaryFlags(V));
   auto *Summary = Index->getGlobalValueSummary(V);
   GlobalVarSummary *VS = cast<GlobalVarSummary>(Summary);
+  NameVals.push_back(getEncodedGVSummaryFlags(VS->flags()));
   unsigned SizeBeforeRefs = NameVals.size();
   for (auto &RI : VS->refs())

More information about the llvm-commits mailing list