[compiler-rt] r353782 - [libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand; second attempt after failed r352732, this time with a fix for cmake
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 11 17:00:09 PST 2019
Author: kcc
Date: Mon Feb 11 17:00:08 2019
New Revision: 353782
URL: http://llvm.org/viewvc/llvm-project?rev=353782&view=rev
Log:
[libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand; second attempt after failed r352732, this time with a fix for cmake
Modified:
compiler-rt/trunk/lib/fuzzer/FuzzerRandom.h
compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt
Modified: compiler-rt/trunk/lib/fuzzer/FuzzerRandom.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerRandom.h?rev=353782&r1=353781&r2=353782&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerRandom.h (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerRandom.h Mon Feb 11 17:00:08 2019
@@ -14,10 +14,10 @@
#include <random>
namespace fuzzer {
-class Random : public std::mt19937 {
+class Random : public std::minstd_rand {
public:
- Random(unsigned int seed) : std::mt19937(seed) {}
- result_type operator()() { return this->std::mt19937::operator()(); }
+ Random(unsigned int seed) : std::minstd_rand(seed) {}
+ result_type operator()() { return this->std::minstd_rand::operator()(); }
size_t Rand() { return this->operator()(); }
size_t RandBool() { return Rand() % 2; }
size_t SkewTowardsLast(size_t n) {
Modified: compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt?rev=353782&r1=353781&r2=353782&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt Mon Feb 11 17:00:08 2019
@@ -46,7 +46,8 @@ if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LI
FOLDER "Compiler-RT Runtime tests")
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH)
- set(LIBFUZZER_TEST_RUNTIME_DEPS libcxx_fuzzer_${arch}-build)
+ file(GLOB libfuzzer_headers ../*.h)
+ set(LIBFUZZER_TEST_RUNTIME_DEPS libcxx_fuzzer_${arch}-build ${libfuzzer_headers})
set(LIBFUZZER_TEST_RUNTIME_CFLAGS -isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1)
set(LIBFUZZER_TEST_RUNTIME_LINK_FLAGS ${LIBCXX_${arch}_PREFIX}/lib/libc++.a)
endif()
More information about the llvm-commits
mailing list