[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
Wed Aug 23 14:06:54 PDT 2017


alex.telishev added a comment.

The problem is that `stable_partition` only used `operator==`, but `stable_sort` needs to use `operator<`. The difference is that comparison of pointers is not deterministic (and equality is), and for non-DefinedRegular symbols we don't have anything to compare except for pointers. Without the need for  deterministic build everything were ok, but now we have only two options - to provide some stable means for comparison (it can be done by adding new member to SymbolBody, or creating a map from SymbolBody * to something) or to treat all DefinedRegular symbols as equal. But if we treat them as equal, some non-identical COMDATS will be folded. Because of it we need to make additional checks after sorting to make sure we don't merge non-identical COMDATS.


https://reviews.llvm.org/D36963





More information about the llvm-commits mailing list