[PATCH] D46228: [ELF] Use union-find set in Call-Chain Clustering (C³) heuristic to improve worst-case time complexity.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 16 11:03:07 PDT 2018


MaskRay added a comment.

This revision mostly optimizes the cluster number reassignment loop (expected O(n log n), but can be O(n^2) at worst):

  // line 210
      for (int SI : C.Sections)
        SecToCluster[SI] = PredC;

to union-find set (fast in practice, O(n log n) at worst (not union-by-rank) but expected O(n α(n)) (I believe)) + list splice (linear)


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D46228





More information about the llvm-commits mailing list