From 2b65b3aa6b0897d1eb97cdf4c51b0ff94a40d5f1 Mon Sep 17 00:00:00 2001 From: Xun Li Date: Thu, 21 May 2020 16:46:27 -0700 Subject: [PATCH] Use shuffle instead of random_shuffle Summary: random_shuffle is deprecated in C++14. (cherry picked from FBD21698180) --- bolt/src/Passes/ReorderAlgorithm.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bolt/src/Passes/ReorderAlgorithm.cpp b/bolt/src/Passes/ReorderAlgorithm.cpp index 341449bdbd0f..2a82a7573524 100644 --- a/bolt/src/Passes/ReorderAlgorithm.cpp +++ b/bolt/src/Passes/ReorderAlgorithm.cpp @@ -15,8 +15,9 @@ #include "BinaryBasicBlock.h" #include "BinaryFunction.h" #include "llvm/Support/CommandLine.h" -#include #include +#include +#include #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: ";