[PATCH] D58245: Remove no-op code.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 14 11:28:28 PST 2019

ruiu created this revision.
ruiu added a reviewer: PkmX.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

I believe relocations are sorted by offset, so this code is redundant.
We have the same assumption for other targets.

  rG LLVM Github Monorepo



Index: lld/ELF/Relocations.cpp
--- lld/ELF/Relocations.cpp
+++ lld/ELF/Relocations.cpp
@@ -1192,13 +1192,6 @@
   for (auto I = Rels.begin(), End = Rels.end(); I != End;)
     scanReloc<ELFT>(Sec, GetOffset, I, End);
-  // Sort relocations by offset to binary search for R_RISCV_PCREL_HI20
-  if (Config->EMachine == EM_RISCV)
-    std::stable_sort(Sec.Relocations.begin(), Sec.Relocations.end(),
-                     [](const Relocation &LHS, const Relocation &RHS) {
-                       return LHS.Offset < RHS.Offset;
-                     });
 template <class ELFT> void elf::scanRelocations(InputSectionBase &S) {

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58245.186880.patch
Type: text/x-patch
Size: 700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190214/6b6ef7b7/attachment.bin>

More information about the llvm-commits mailing list