[PATCH] D58373: [Dominators] Avoid potentially quadratic std::is_permutation

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 27 19:39:17 PST 2019


kuhar added a comment.

If you think you there's enough evidence that is_permutation can cause a problems here, go ahead with the current patch.

I grepped the whole monorepo and `std::is_permuation` is only used in libcxx and in dominators. I like it because it has a very strong and clear semantic meaning, as opposed to relying on set properties. I think that it's the case that the only thing that is the issue is the implementation that makes the unfortunate tradeoff between allocating and complexity. I claim that it would be best to preserve the descriptive name, while making the implementation use DenseSet for larger instances -- this could go into STLExtras in llvm. But because it's not widely used in llvm, I can live with the patch committed as-is.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58373/new/

https://reviews.llvm.org/D58373





More information about the llvm-commits mailing list