[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 12:27:34 PDT 2017


alex.telishev added a comment.

> Okay, let's consider chunks [c1, c2, ..., c_n] as integers [1, 2, ..., n]. If we consider their addresses as integers, that makes sense. Now, assume that c2 equals to c3 in terms of ICF, but no other chunks equal to any other chunks.

I'm not saying we should treat their addresses as integers, it's of course wrong. I mean that ICF equality function compares a bunch of values (basically integer)  inside of two chunks. consider that chunk C_i is composed of integers [x_i1, xi2, ..., x_ik] and ICF comparison function is C_m = C_n iff x_m1== x_n1 && x_m2== x_n2, && ... && x_mk== x_nk. Then we can choose comparison function as C_m < C_n iff [x_m1, xm2, ..., x_mk] < [x_n1, xn2, ..., x_nk] where compasion is done lexicographically.

> Are you testing with /DEBUG or without?

Last test was without /DEBUG and both version sometimes produced different results (not is size though)


https://reviews.llvm.org/D36963





More information about the llvm-commits mailing list