diff options
author | Kostya Serebryany <kcc@google.com> | 2015-10-17 04:38:26 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2015-10-17 04:38:26 +0000 |
commit | fed509e73d09f1f082db6ed51564cc5f241cc4be (patch) | |
tree | 50d15238b120a97dda3f385c2d18b3557f4c2f8a /llvm/lib/Fuzzer/FuzzerLoop.cpp | |
parent | 3acf5fdd885e37708e79b13bf5b8cd58c0df2265 (diff) | |
download | bcm5719-llvm-fed509e73d09f1f082db6ed51564cc5f241cc4be.tar.gz bcm5719-llvm-fed509e73d09f1f082db6ed51564cc5f241cc4be.zip |
[libFuzzer] add -shuffle flag
llvm-svn: 250603
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerLoop.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp index a642bbbf5cb..ef71407d21c 100644 --- a/llvm/lib/Fuzzer/FuzzerLoop.cpp +++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp @@ -137,11 +137,13 @@ void Fuzzer::ShuffleAndMinimize() { Printf("PreferSmall: %d\n", PreferSmall); PrintStats("READ ", 0); std::vector<Unit> NewCorpus; - std::random_shuffle(Corpus.begin(), Corpus.end(), USF.GetRand()); - if (PreferSmall) - std::stable_sort( - Corpus.begin(), Corpus.end(), - [](const Unit &A, const Unit &B) { return A.size() < B.size(); }); + if (Options.ShuffleAtStartUp) { + std::random_shuffle(Corpus.begin(), Corpus.end(), USF.GetRand()); + if (PreferSmall) + std::stable_sort( + Corpus.begin(), Corpus.end(), + [](const Unit &A, const Unit &B) { return A.size() < B.size(); }); + } Unit &U = CurrentUnit; for (const auto &C : Corpus) { for (size_t First = 0; First < 1; First++) { |