[PATCH] D158875: [ADT] Fix IntEqClasses::join to return the leader in all cases.

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 13:37:25 PDT 2023


MatzeB added a comment.

Nice catch!



================
Comment at: llvm/lib/Support/IntEqClasses.cpp:36-52
   // Update pointers while searching for the leaders, compressing the paths
   // incrementally. The larger leader will eventually be updated, joining the
   // classes.
   while (eca != ecb)
     if (eca < ecb) {
       EC[b] = eca;
       b = ecb;
----------------
Not sure how this would affect worst-case complexity given `findLeader` does not do any path compression. How about this instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158875



More information about the llvm-commits mailing list