diff --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h --- a/llvm/include/llvm/IR/Module.h +++ b/llvm/include/llvm/IR/Module.h @@ -259,7 +259,7 @@ /// when other randomness consuming passes are added or removed. In /// addition, the random stream will be reproducible across LLVM /// versions when the pass does not change. - std::unique_ptr createRNG(const Pass* P) const; + std::unique_ptr createRNG(const StringRef Name) const; /// Return true if size-info optimization remark is enabled, false /// otherwise. diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp --- a/llvm/lib/IR/Module.cpp +++ b/llvm/lib/IR/Module.cpp @@ -85,8 +85,9 @@ IFuncList.clear(); } -std::unique_ptr Module::createRNG(const Pass* P) const { - SmallString<32> Salt(P->getPassName()); +std::unique_ptr +Module::createRNG(const StringRef Name) const { + SmallString<32> Salt(Name); // This RNG is guaranteed to produce the same random stream only // when the Module ID and thus the input filename is the same. This @@ -100,7 +101,8 @@ // store salt metadata from the Module constructor. Salt += sys::path::filename(getModuleIdentifier()); - return std::unique_ptr(new RandomNumberGenerator(Salt)); + return std::unique_ptr( + new RandomNumberGenerator(Salt)); } /// getNamedValue - Return the first global value in the module with diff --git a/llvm/unittests/IR/ModuleTest.cpp b/llvm/unittests/IR/ModuleTest.cpp --- a/llvm/unittests/IR/ModuleTest.cpp +++ b/llvm/unittests/IR/ModuleTest.cpp @@ -63,7 +63,7 @@ std::array RandomStreams[2]; for (auto &RandomStream : RandomStreams) { - std::unique_ptr RNG = M.createRNG(&DP); + std::unique_ptr RNG = M.createRNG(DP->getPassName()); std::generate(RandomStream.begin(), RandomStream.end(), [&]() { return dist(*RNG); }); }