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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 12 14:52:14 PDT 2018


ruiu added inline comments.


================
Comment at: ELF/CallGraphSort.cpp:161
 
+static int findLeader(std::vector<int> &Leaders, int V) {
+  while (Leaders[V] != V) {
----------------
ruiu wrote:
> I perhaps didn't spent enough effort to understand this function, but it feels something is wrong with this function. The function name implies this function "finds" something, but looks like it actually mutates a given vector.
I don't think any function that has a side effect (other than caching a result) have a function name that starts with "find". "Find" implies a pure function. Please give it a different name.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D46228





More information about the llvm-commits mailing list