[PATCH] D45436: [llvm-exegesis] Add a flag to disable libpfm even if present.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 9 06:49:09 PDT 2018


courbet updated this revision to Diff 141637.
courbet marked an inline comment as done.
courbet added a comment.

Double check for LLVM_ENABLE_LIBPFM and HAVE_LIBPFM when linking.


Repository:
  rL LLVM

https://reviews.llvm.org/D45436

Files:
  CMakeLists.txt
  cmake/config-ix.cmake
  docs/CMake.rst
  tools/llvm-exegesis/CMakeLists.txt
  unittests/tools/llvm-exegesis/CMakeLists.txt


Index: unittests/tools/llvm-exegesis/CMakeLists.txt
===================================================================
--- unittests/tools/llvm-exegesis/CMakeLists.txt
+++ unittests/tools/llvm-exegesis/CMakeLists.txt
@@ -22,7 +22,6 @@
   )
 target_link_libraries(LLVMExegesisTests PRIVATE LLVMExegesis)
 
-if(HAVE_LIBPFM)
+if(LLVM_ENABLE_LIBPFM AND HAVE_LIBPFM)
   target_link_libraries(LLVMExegesisTests PRIVATE pfm)
 endif()
-
Index: tools/llvm-exegesis/CMakeLists.txt
===================================================================
--- tools/llvm-exegesis/CMakeLists.txt
+++ tools/llvm-exegesis/CMakeLists.txt
@@ -10,7 +10,6 @@
 add_subdirectory(lib)
 target_link_libraries(llvm-exegesis PRIVATE LLVMExegesis)
 
-if(HAVE_LIBPFM)
+if(LLVM_ENABLE_LIBPFM AND HAVE_LIBPFM)
   target_link_libraries(llvm-exegesis PRIVATE pfm)
 endif()
-
Index: docs/CMake.rst
===================================================================
--- docs/CMake.rst
+++ docs/CMake.rst
@@ -374,6 +374,11 @@
 **LLVM_USE_INTEL_JITEVENTS**:BOOL
   Enable building support for Intel JIT Events API. Defaults to OFF.
 
+**LLVM_ENABLE_LIBPFM**:BOOL
+  Enable building with libpfm to support hardware counter measurements in LLVM
+  tools.
+  Defaults to ON.
+
 **LLVM_ENABLE_ZLIB**:BOOL
   Enable building with zlib to support compression/uncompression in LLVM tools.
   Defaults to ON.
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -90,13 +90,15 @@
 endif()
 
 # Check for libpfm.
-check_library_exists(pfm pfm_initialize "" HAVE_LIBPFM_INITIALIZE)
-if(HAVE_LIBPFM_INITIALIZE)
-  check_include_file(perfmon/perf_event.h HAVE_PERFMON_PERF_EVENT_H)
-  check_include_file(perfmon/pfmlib.h HAVE_PERFMON_PFMLIB_H)
-  check_include_file(perfmon/pfmlib_perf_event.h HAVE_PERFMON_PFMLIB_PERF_EVENT_H)
-  if(HAVE_PERFMON_PERF_EVENT_H AND HAVE_PERFMON_PFMLIB_H AND HAVE_PERFMON_PFMLIB_PERF_EVENT_H)
-    set(HAVE_LIBPFM 1)
+if (LLVM_ENABLE_LIBPFM)
+  check_library_exists(pfm pfm_initialize "" HAVE_LIBPFM_INITIALIZE)
+  if(HAVE_LIBPFM_INITIALIZE)
+    check_include_file(perfmon/perf_event.h HAVE_PERFMON_PERF_EVENT_H)
+    check_include_file(perfmon/pfmlib.h HAVE_PERFMON_PFMLIB_H)
+    check_include_file(perfmon/pfmlib_perf_event.h HAVE_PERFMON_PFMLIB_PERF_EVENT_H)
+    if(HAVE_PERFMON_PERF_EVENT_H AND HAVE_PERFMON_PFMLIB_H AND HAVE_PERFMON_PFMLIB_PERF_EVENT_H)
+      set(HAVE_LIBPFM 1)
+    endif()
   endif()
 endif()
 
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -366,6 +366,8 @@
 
 option(LLVM_ENABLE_LIBEDIT "Use libedit if available." ON)
 
+option(LLVM_ENABLE_LIBPFM "Use libpfm for performance counters if available." ON)
+
 option(LLVM_ENABLE_THREADS "Use threads if available." ON)
 
 option(LLVM_ENABLE_ZLIB "Use zlib for compression/decompression if available." ON)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45436.141637.patch
Type: text/x-patch
Size: 2945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180409/a0666a30/attachment.bin>


More information about the llvm-commits mailing list