Subzero: Use a "deterministic" random shuffle for register allocation. To make this work, Subzero provides its own RandomShuffle() as a replacement for std::random_shuffle(), and the Subzero implementation doesn't depend on the stdlib implementation. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4129 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/1072913002
diff --git a/unittest/IceELFSectionTest.cpp b/unittest/IceELFSectionTest.cpp index 8dbcc65..57e43c1 100644 --- a/unittest/IceELFSectionTest.cpp +++ b/unittest/IceELFSectionTest.cpp
@@ -90,8 +90,11 @@ Strings.push_back(".shstrtab"); Strings.push_back("_start"); const SizeT NumTests = 128; + const uint64_t RandomSeed = 12345; // arbitrary value for now + RandomNumberGenerator R(RandomSeed); + RandomNumberGeneratorWrapper RNG(R); for (SizeT i = 0; i < NumTests; ++i) { - std::random_shuffle(Strings.begin(), Strings.end()); + RandomShuffle(Strings.begin(), Strings.end(), RNG); ELFStringTableSection Strtab(".strtab", SHT_STRTAB, 0, 1, 0); for (auto &S : Strings) { Strtab.add(S);