Chromium Code Reviews| Index: src/IceTargetLoweringX8632.cpp |
| diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp |
| index 466564d8408bba025e049ef93f2c557d935818c3..8f278b0ecf0907884748ad20cf05c6647e3241bb 100644 |
| --- a/src/IceTargetLoweringX8632.cpp |
| +++ b/src/IceTargetLoweringX8632.cpp |
| @@ -731,10 +731,18 @@ void TargetDataX8632::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()) { |
| + if (!Pool.empty()) { |
|
Jim Stichnoth
2015/08/19 19:03:04
can probably combine this condition with the above
qining
2015/08/19 23:25:49
Done.
|
| + // 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(), |
| + RS_PooledConstantReordering, K); |
| + RandomShuffle(Pool.begin(), Pool.end(), |
| + [&RNG](uint64_t N) { return (uint32_t)RNG.next(N); }); |
| + } |
| + } |
| for (Constant *C : Pool) { |
| if (!C->getShouldBePooled()) |