[lld] 0a28cfd - [ELF] Simplify getRankProximity. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 30 16:32:46 PDT 2022


Author: Fangrui Song
Date: 2022-07-30T16:32:42-07:00
New Revision: 0a28cfdff5e2e48454ba66f27fa9670d5dcc9cd5

URL: https://github.com/llvm/llvm-project/commit/0a28cfdff5e2e48454ba66f27fa9670d5dcc9cd5
DIFF: https://github.com/llvm/llvm-project/commit/0a28cfdff5e2e48454ba66f27fa9670d5dcc9cd5.diff

LOG: [ELF] Simplify getRankProximity. NFC

Added: 
    

Modified: 
    lld/ELF/Writer.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 375aa684b798..e4e6cb242436 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1100,14 +1100,10 @@ template <class ELFT> void Writer<ELFT>::setReservedSymbolSections() {
 // The more branches in getSectionRank that match, the more similar they are.
 // Since each branch corresponds to a bit flag, we can just use
 // countLeadingZeros.
-static int getRankProximityAux(const OutputSection &a, const OutputSection &b) {
-  return countLeadingZeros(a.sortRank ^ b.sortRank);
-}
-
 static int getRankProximity(OutputSection *a, SectionCommand *b) {
   auto *osd = dyn_cast<OutputDesc>(b);
   return (osd && osd->osec.hasInputSections)
-             ? getRankProximityAux(*a, osd->osec)
+             ? countLeadingZeros(a->sortRank ^ osd->osec.sortRank)
              : -1;
 }
 


        


More information about the llvm-commits mailing list