[PATCH] D36963: Use sorting instead of a lot of stable_partitions for `ICF::segregate` function

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 23 08:13:21 PDT 2017


ruiu added a comment.

As to the number of iterations, MSVC's and our algorithms are different, so it doesn't make much sense to compare the raw numbers. It's okay as long as our algorithm is faster and more accurate than the MSVC's.



================
Comment at: lld/COFF/ICF.cpp:112
+  for (size_t Pos = Begin + 1; Pos < End; Pos++) {
+    if (Equal(Chunks[GroupBegin], Chunks[Pos]))
+      continue;
----------------
alex.telishev wrote:
> ruiu wrote:
> > I believe you can use Less instead of Equal and remove equals{Constant,Variables} functions. What am I missing?
> We changed `Less{Constant,Variables}` functions so now every non-`DefinedRegular` relocations are equal to each other.  As the result they will all receive the same Class if we use `Less` function in the loop.  
Can you make a change to `less` functions so that you can remove `equals` functions somehow?


https://reviews.llvm.org/D36963





More information about the llvm-commits mailing list