[PATCH] D61698: [COFF] Store alignment in log2 form, NFC

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 13 14:07:20 PDT 2019


aganea added inline comments.


================
Comment at: lld/COFF/Chunks.cpp:865
 void MergeChunk::addSection(SectionChunk *C) {
-  auto *&MC = Instances[C->Alignment];
+  assert(isPowerOf2_32(C->getAlignment()));
+  uint8_t P2Align = llvm::Log2_32(C->getAlignment());
----------------
This is essentially the same code as `Chunk::setAlignment`, can you make it so that a static version of that function is used here instead?


================
Comment at: lld/COFF/Chunks.h:71
+    P2Align = llvm::Log2_32(Align);
+  }
+
----------------
`assert(P2Align<=Log2MaxSectionAlignment)` ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61698/new/

https://reviews.llvm.org/D61698





More information about the llvm-commits mailing list