[llvm] r314870 - [FuzzerUtil] Partially revert D38481 on FuzzerUtil
Tim Shen via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 3 18:05:34 PDT 2017
Author: timshen
Date: Tue Oct 3 18:05:34 2017
New Revision: 314870
URL: http://llvm.org/viewvc/llvm-project?rev=314870&view=rev
Log:
[FuzzerUtil] Partially revert D38481 on FuzzerUtil
This is because lib/Fuzzer doesn't really depend on llvm infrastucture.
It's not easy to access the llvm hardware_concurrency here.
Differential Reivision: https://reviews.llvm.org/D38481
Modified:
llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp?rev=314870&r1=314869&r2=314870&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp Tue Oct 3 18:05:34 2017
@@ -195,7 +195,15 @@ void PrintPC(const char *SymbolizedFMT,
Printf(FallbackFMT, PC);
}
-unsigned NumberOfCpuCores() { return hardware_concurrency(); }
+unsigned NumberOfCpuCores() {
+ unsigned N = std::thread::hardware_concurrency();
+ if (!N) {
+ Printf("WARNING: std::thread::hardware_concurrency not well defined for "
+ "your platform. Assuming CPU count of 1.\n");
+ N = 1;
+ }
+ return N;
+}
size_t SimpleFastHash(const uint8_t *Data, size_t Size) {
size_t Res = 0;
More information about the llvm-commits
mailing list