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

Alex Telishev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 13:47:41 PDT 2017


alex.telishev added a comment.

> Now consider lessVariable(C1, C2). At line 191, lessVariable returns true because S1<S2. How about lessVariable(C2, C3)? At line 191, lessVaraible returns true because S2<S3. At this point, it concludes that C1<C2<C3. But that's wrong because both lessVaraible(C1, C3) and lessVariable(C3, C1) return false. That's what I was saying that the comparison function is not transitive.

I thought about that, this problem is taken care of because of type comparion - lessVariable(C1, C2) will `return false` at line 141. Actually, at line 191 we can only be both `nullptr` or both not.


https://reviews.llvm.org/D36963





More information about the llvm-commits mailing list