[llvm] 04f8ffd - [llvm-exegesis] Fix compilation with old libpfm versions.
Clement Courbet via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 11 22:54:49 PDT 2021
Author: Clement Courbet
Date: 2021-07-12T07:48:29+02:00
New Revision: 04f8ffd98306a0b0b60987208547ee6745b0fc3e
URL: https://github.com/llvm/llvm-project/commit/04f8ffd98306a0b0b60987208547ee6745b0fc3e
DIFF: https://github.com/llvm/llvm-project/commit/04f8ffd98306a0b0b60987208547ee6745b0fc3e.diff
LOG: [llvm-exegesis] Fix compilation with old libpfm versions.
Do not try include `perfmon/perf_event.h` when we are not sure that it
exists.
Fixes PR51017.
Differential Revision: https://reviews.llvm.org/D105615
Added:
Modified:
llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp b/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
index 4d2262750e9a..e5b490e02049 100644
--- a/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
+++ b/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 @@ llvm::Error X86LbrCounter::checkLbrSupport() {
}
counter.stop();
+ (void)Sum;
auto ResultOrError = counter.doReadCounter(nullptr, nullptr);
if (ResultOrError)
More information about the llvm-commits
mailing list