[PATCH] D105615: [llvm-exegesis] Fix compilation with old libpfm versions.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 8 01:54:30 PDT 2021


courbet created this revision.
courbet added a reviewer: oontvoo.
Herald added a subscriber: mstojanovic.
courbet requested review of this revision.
Herald added a project: LLVM.

Do not try include `perfmon/perf_event.h` when we are not sure that it
exists.

Fixes PR51017.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105615

Files:
  llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp


Index: llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
===================================================================
--- llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
+++ llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
@@ -8,6 +8,8 @@
 
 #include "X86Counter.h"
 
+#if defined(HAVE_LIBPFM) && defined(LIBPFM_HAS_FIELD_CYCLES)
+
 // FIXME: Use appropriate wrappers for poll.h and mman.h
 // to support Windows and remove this linux-only guard.
 #ifdef __linux__
@@ -32,7 +34,6 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
-#if defined(HAVE_LIBPFM) && defined(LIBPFM_HAS_FIELD_CYCLES)
 namespace llvm {
 namespace exegesis {
 
@@ -178,6 +179,7 @@
   }
 
   counter.stop();
+  (void)Sum;
 
   auto ResultOrError = counter.doReadCounter(nullptr, nullptr);
   if (ResultOrError)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105615.357165.patch
Type: text/x-patch
Size: 786 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210708/6b73d9b6/attachment.bin>


More information about the llvm-commits mailing list