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
1 changed files with 4 additions and 3 deletions

View File

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