Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused RNG element from MBAAdd.cpp #109

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions lib/MBAAdd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,7 @@ STATISTIC(SubstCount, "The # of substituted instructions");
//-----------------------------------------------------------------------------
bool MBAAdd::runOnBasicBlock(BasicBlock &BB) {
bool Changed = false;

// Get a (rather naive) random number generator that will be used to decide
// whether to replace the current instruction or not.
// FIXME We should be using 'Module::createRNG' here instead. However, that
// method requires a pointer to 'Pass' on input and passes
// for the new pass manager _do_not_ inherit from llvm::Pass. In other words,
// 'createRNG' cannot be used here and there's no other way of obtaining
// llvm::RandomNumberGenerator. Last checked for LLVM 8.
std::mt19937_64 RNG;
RNG.seed(1234);
std::uniform_real_distribution<double> Dist(0., 1.);


// Loop over all instructions in the block. Replacing instructions requires
// iterators, hence a for-range loop wouldn't be suitable
for (auto Inst = BB.begin(), IE = BB.end(); Inst != IE; ++Inst) {
Expand Down
Loading