[PATCH] D11345: ignore duplicate divisor uses when transforming into reciprocal multiplies (PR24141)

Chandler Carruth chandlerc at gmail.com
Mon Jul 20 16:04:43 PDT 2015

chandlerc added a subscriber: chandlerc.
chandlerc added a comment.

In http://reviews.llvm.org/D11345#208493, @spatel wrote:

> Patch updated:
>  I just discovered 'SmallPtrSet'. 
>  Looks like it was designed exactly for this case, so let's use it here instead of a vector. Then, we don't have to use std::find() for dup checking.

Egads no, that makes the iteration order unstable.

This whole thing seems wrongly formulated. Why are we walking the *entire* users list prior to finding out whether there are few enough users? I feel like the TLI interface should say how many can be handled rather than accepting a number we want to handle.

And then the code here should be to insert into a SetVector until we exceed that threshold.


More information about the llvm-commits mailing list