[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 01:37:23 PDT 2017


alex.telishev added a comment.

How exactly have you tested for non-determinism? I've tried to do that by comparing output binaries for my project, but they were different every time even before this patch. Could you try testing for determinism with and without this patch?

> But this is not doable because, if we do know that before defining a < relation, we could just simply use that fact to find all chunks that are equal to a given chunk.

I don't get this part. Consider, for example, that chunks were just integer values. You're saying that we cannot use `sort` to segregate them. But it's obviously wrong. Similarly, everything works if chunks are collections of `int`s, and we're comparing them in lexicographical order.  Note that chunk is basically a collection of `int`s, `string`s  etc. The only hard thing is that `dyn_cast`, but as we first compare by type, if we get to there, it should either both fail, or both success. What I'm saying is that we //know// which chunks are equal when writing that comparison function, and can write correct comparison function.


https://reviews.llvm.org/D36963





More information about the llvm-commits mailing list