[llvm] r279601 - [libFuzzer] use __attribute__((target("popcnt"))) only on x86_64
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 23 18:38:43 PDT 2016
Author: kcc
Date: Tue Aug 23 20:38:42 2016
New Revision: 279601
URL: http://llvm.org/viewvc/llvm-project?rev=279601&view=rev
Log:
[libFuzzer] use __attribute__((target("popcnt"))) only on x86_64
Modified:
llvm/trunk/lib/Fuzzer/CMakeLists.txt
llvm/trunk/lib/Fuzzer/FuzzerInternal.h
llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp
llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h
Modified: llvm/trunk/lib/Fuzzer/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/CMakeLists.txt?rev=279601&r1=279600&r2=279601&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/CMakeLists.txt (original)
+++ llvm/trunk/lib/Fuzzer/CMakeLists.txt Tue Aug 23 20:38:42 2016
@@ -1,6 +1,6 @@
set(LIBFUZZER_FLAGS_BASE "${CMAKE_CXX_FLAGS}")
# Disable the coverage and sanitizer instrumentation for the fuzzer itself.
-set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -mpopcnt -fno-sanitize=all -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters -Werror")
+set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fno-sanitize=all -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters -Werror")
if( LLVM_USE_SANITIZE_COVERAGE )
if(NOT "${LLVM_USE_SANITIZER}" STREQUAL "Address")
message(FATAL_ERROR
Modified: llvm/trunk/lib/Fuzzer/FuzzerInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerInternal.h?rev=279601&r1=279600&r2=279601&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerInternal.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerInternal.h Tue Aug 23 20:38:42 2016
@@ -26,10 +26,6 @@
#include <unordered_set>
#include <vector>
-#include "FuzzerExtFunctions.h"
-#include "FuzzerInterface.h"
-#include "FuzzerValueBitMap.h"
-
// Platform detection.
#ifdef __linux__
#define LIBFUZZER_LINUX 1
@@ -41,6 +37,16 @@
#error "Support for your platform has not been implemented"
#endif
+#ifdef __x86_64
+#define ATTRIBUTE_TARGET_POPCNT __attribute__((target("popcnt")))
+#else
+#define ATTRIBUTE_TARGET_POPCNT
+#endif
+
+#include "FuzzerExtFunctions.h"
+#include "FuzzerInterface.h"
+#include "FuzzerValueBitMap.h"
+
namespace fuzzer {
typedef int (*UserCallback)(const uint8_t *Data, size_t Size);
Modified: llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp?rev=279601&r1=279600&r2=279601&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp Tue Aug 23 20:38:42 2016
@@ -574,7 +574,7 @@ static void AddValueForStrcmp(void *call
VP.AddValue((PC & 4095) | (LastSameByte << 12));
}
-__attribute__((target("popcnt")))
+ATTRIBUTE_TARGET_POPCNT
static void AddValueForCmp(void *PCptr, uint64_t Arg1, uint64_t Arg2) {
if (Arg1 == Arg2)
return;
Modified: llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h?rev=279601&r1=279600&r2=279601&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h Tue Aug 23 20:38:42 2016
@@ -34,7 +34,7 @@ struct ValueBitMap {
// Merges 'Other' into 'this', clears 'Other',
// returns the number of set bits in 'this'.
- __attribute__((target("popcnt")))
+ ATTRIBUTE_TARGET_POPCNT
size_t MergeFrom(ValueBitMap &Other) {
uintptr_t Res = 0;
for (size_t i = 0; i < kMapSizeInWords; i++) {
More information about the llvm-commits
mailing list