Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1468)

Unified Diff: src/IceTargetLoweringX8664.cpp

Issue 1300993002: Use separate random number generator for each randomization pass (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: rebase to master Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLoweringX8632Traits.h ('k') | src/IceTargetLoweringX8664Traits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX8664.cpp
diff --git a/src/IceTargetLoweringX8664.cpp b/src/IceTargetLoweringX8664.cpp
index 41d24cc8baf52dbc511347f626e32fc9ca5f8887..76fffa04039c1de54e4884ab05aa55c9fdcf5c3f 100644
--- a/src/IceTargetLoweringX8664.cpp
+++ b/src/IceTargetLoweringX8664.cpp
@@ -743,10 +743,15 @@ void TargetDataX8664::emitConstantPool(GlobalContext *Ctx) {
// If reorder-pooled-constants option is set to true, we need to shuffle the
// constant pool before emitting it.
- if (Ctx->getFlags().shouldReorderPooledConstants())
- RandomShuffle(Pool.begin(), Pool.end(), [Ctx](uint64_t N) {
- return (uint32_t)Ctx->getRNG().next(N);
- });
+ if (Ctx->getFlags().shouldReorderPooledConstants()) {
+ // Use the constant's kind value as the salt for creating random number
+ // generator.
+ Operand::OperandKind K = (*Pool.begin())->getKind();
+ RandomNumberGenerator RNG(Ctx->getFlags().getRandomSeed(),
+ RPE_PooledConstantReordering, K);
+ RandomShuffle(Pool.begin(), Pool.end(),
+ [&RNG](uint64_t N) { return (uint32_t)RNG.next(N); });
+ }
for (Constant *C : Pool) {
if (!C->getShouldBePooled())
« no previous file with comments | « src/IceTargetLoweringX8632Traits.h ('k') | src/IceTargetLoweringX8664Traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698