[lld] r361549 - [COFF] Move KeepUnique bit from Chunk to SectionChunk, NFC

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 13:26:42 PDT 2019


Author: rnk
Date: Thu May 23 13:26:41 2019
New Revision: 361549

URL: http://llvm.org/viewvc/llvm-project?rev=361549&view=rev
Log:
[COFF] Move KeepUnique bit from Chunk to SectionChunk, NFC

The KeepUnique bit is used during ICF, which only operates on
SectionChunks, so only SectionChunks need it. This frees up a byte in
Chunk, which I plan to use in a follow-up change.

Modified:
    lld/trunk/COFF/Chunks.h
    lld/trunk/COFF/Driver.cpp

Modified: lld/trunk/COFF/Chunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.h?rev=361549&r1=361548&r2=361549&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.h (original)
+++ lld/trunk/COFF/Chunks.h Thu May 23 13:26:41 2019
@@ -122,14 +122,9 @@ public:
 
 protected:
   Chunk(Kind K = OtherKind) : ChunkKind(K) {}
-  const Kind ChunkKind;
 
-public:
-  // Whether this section needs to be kept distinct from other sections during
-  // ICF. This is set by the driver using address-significance tables.
-  bool KeepUnique = false;
+  const Kind ChunkKind;
 
-protected:
   // The alignment of this chunk, stored in log2 form. The writer uses the
   // value.
   uint8_t P2Align = 0;
@@ -137,7 +132,6 @@ protected:
   // The RVA of this chunk in the output. The writer sets a value.
   uint32_t RVA = 0;
 
-protected:
   // The output section for this chunk.
   OutputSection *Out = nullptr;
 };
@@ -283,6 +277,10 @@ public:
   // Used by the garbage collector.
   bool Live;
 
+  // Whether this section needs to be kept distinct from other sections during
+  // ICF. This is set by the driver using address-significance tables.
+  bool KeepUnique = false;
+
   // The COMDAT selection if this is a COMDAT chunk.
   llvm::COFF::COMDATType Selection = (llvm::COFF::COMDATType)0;
 

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=361549&r1=361548&r2=361549&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Thu May 23 13:26:41 2019
@@ -858,7 +858,7 @@ static void parseOrderFile(StringRef Arg
 
 static void markAddrsig(Symbol *S) {
   if (auto *D = dyn_cast_or_null<Defined>(S))
-    if (Chunk *C = D->getChunk())
+    if (SectionChunk *C = dyn_cast_or_null<SectionChunk>(D->getChunk()))
       C->KeepUnique = true;
 }
 




More information about the llvm-commits mailing list