Use shuffle instead of random_shuffle

Summary: random_shuffle is deprecated in C++14.

(cherry picked from FBD21698180)
This commit is contained in:
Xun Li
2020-05-21 16:46:27 -07:00
committed by Maksim Panchenko
parent 8a680745dd
commit 2b65b3aa6b

View File

@@ -15,8 +15,9 @@
#include "BinaryBasicBlock.h"
#include "BinaryFunction.h"
#include "llvm/Support/CommandLine.h"
#include <queue>
#include <functional>
#include <queue>
#include <random>
#undef DEBUG_TYPE
#define DEBUG_TYPE "bolt"
@@ -720,8 +721,8 @@ void RandomClusterReorderAlgorithm::reorderBasicBlocks(
if (!Clusters[I].empty())
ClusterOrder.push_back(I);
std::srand(opts::RandomSeed);
std::random_shuffle(std::next(ClusterOrder.begin()), ClusterOrder.end());
std::shuffle(std::next(ClusterOrder.begin()), ClusterOrder.end(),
std::default_random_engine(opts::RandomSeed.getValue()));
if (opts::PrintClusters) {
errs() << "New cluster order: ";