[Dominators] Avoid potentially quadratic std::is_permutation
If the two sequences are not equal, std::is_permutation may be O(N^2)
and indeed the case in libstdc++ and libc++. Use SmallPtrSet to prevent
pessimizing cases. On my machine, SmallPtrSet starts to outperform
std::is_permutation when there are 16 elements.
Reviewed By: kuhar
Subscribers: kristina, jdoerfert, llvm-commits
Differential Revision: https://reviews.llvm.org/D58373