[Statepoints] Skip a vector copy when uniquing values.
No functionality change intended. llvm-svn: 239688
This commit is contained in:
parent
bd7b1c89fc
commit
258ea0dbdf
|
@ -1659,17 +1659,10 @@ static void relocationViaAlloca(
|
||||||
/// vector. Doing so has the effect of changing the output of a couple of
|
/// vector. Doing so has the effect of changing the output of a couple of
|
||||||
/// tests in ways which make them less useful in testing fused safepoints.
|
/// tests in ways which make them less useful in testing fused safepoints.
|
||||||
template <typename T> static void unique_unsorted(SmallVectorImpl<T> &Vec) {
|
template <typename T> static void unique_unsorted(SmallVectorImpl<T> &Vec) {
|
||||||
DenseSet<T> Seen;
|
SmallSet<T, 8> Seen;
|
||||||
SmallVector<T, 128> TempVec;
|
Vec.erase(std::remove_if(Vec.begin(), Vec.end(), [&](const T &V) {
|
||||||
TempVec.reserve(Vec.size());
|
return !Seen.insert(V).second;
|
||||||
for (auto Element : Vec)
|
}), Vec.end());
|
||||||
TempVec.push_back(Element);
|
|
||||||
Vec.clear();
|
|
||||||
for (auto V : TempVec) {
|
|
||||||
if (Seen.insert(V).second) {
|
|
||||||
Vec.push_back(V);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Insert holders so that each Value is obviously live through the entire
|
/// Insert holders so that each Value is obviously live through the entire
|
||||||
|
|
Loading…
Reference in New Issue