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

Side by Side Diff: src/IceCfg.cpp

Issue 1306713002: Fix bug in the call to random number generator in Cfg's ctor (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/randomize-pool-immediate-basic.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// 1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 25 matching lines...) Expand all
36 36
37 Cfg::Cfg(GlobalContext *Ctx, uint32_t SequenceNumber) 37 Cfg::Cfg(GlobalContext *Ctx, uint32_t SequenceNumber)
38 : Ctx(Ctx), SequenceNumber(SequenceNumber), 38 : Ctx(Ctx), SequenceNumber(SequenceNumber),
39 VMask(Ctx->getFlags().getVerbose()), NextInstNumber(Inst::NumberInitial), 39 VMask(Ctx->getFlags().getVerbose()), NextInstNumber(Inst::NumberInitial),
40 Allocator(new ArenaAllocator<>()), Live(nullptr), 40 Allocator(new ArenaAllocator<>()), Live(nullptr),
41 Target(TargetLowering::createLowering(Ctx->getFlags().getTargetArch(), 41 Target(TargetLowering::createLowering(Ctx->getFlags().getTargetArch(),
42 this)), 42 this)),
43 VMetadata(new VariablesMetadata(this)), 43 VMetadata(new VariablesMetadata(this)),
44 TargetAssembler(TargetLowering::createAssembler( 44 TargetAssembler(TargetLowering::createAssembler(
45 Ctx->getFlags().getTargetArch(), this)) { 45 Ctx->getFlags().getTargetArch(), this)) {
46 assert(!Ctx->isIRGenerationDisabled() &&
47 "Attempt to build cfg when IR generation disabled");
48 if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_Randomize) { 46 if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_Randomize) {
49 // If -randomize-pool-immediates=randomize, create a random number generator 47 // If -randomize-pool-immediates=randomize, create a random number generator
50 // to generate a cookie for constant blinding. 48 // to generate a cookie for constant blinding.
51 RandomNumberGenerator RNG(Ctx->getFlags().getRandomSeed(), 49 RandomNumberGenerator RNG(Ctx->getFlags().getRandomSeed(),
52 RPE_ConstantBlinding, SequenceNumber); 50 RPE_ConstantBlinding, this->SequenceNumber);
Jim Stichnoth 2015/08/21 00:12:31 I think you can drop the "this->", right?
53 ConstantBlindingCookie = 51 ConstantBlindingCookie =
54 (uint32_t)RNG.next((uint64_t)std::numeric_limits<uint32_t>::max + 1); 52 (uint32_t)RNG.next((uint64_t)std::numeric_limits<uint32_t>::max() + 1);
55 } 53 }
56 } 54 }
57 55
58 Cfg::~Cfg() { assert(ICE_TLS_GET_FIELD(CurrentCfg) == nullptr); } 56 Cfg::~Cfg() { assert(ICE_TLS_GET_FIELD(CurrentCfg) == nullptr); }
59 57
60 void Cfg::setError(const IceString &Message) { 58 void Cfg::setError(const IceString &Message) {
61 HasError = true; 59 HasError = true;
62 ErrorMessage = Message; 60 ErrorMessage = Message;
63 } 61 }
64 62
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 } 771 }
774 } 772 }
775 // Print each basic block 773 // Print each basic block
776 for (CfgNode *Node : Nodes) 774 for (CfgNode *Node : Nodes)
777 Node->dump(this); 775 Node->dump(this);
778 if (isVerbose(IceV_Instructions)) 776 if (isVerbose(IceV_Instructions))
779 Str << "}\n"; 777 Str << "}\n";
780 } 778 }
781 779
782 } // end of namespace Ice 780 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/randomize-pool-immediate-basic.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698