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: ";