[llvm] a35480f - [llvm-exegesis] Fix missing-headers build errors.

Vy Nguyen via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 10:20:58 PDT 2021


Author: Vy Nguyen
Date: 2021-07-15T13:20:25-04:00
New Revision: a35480f85960feccc44ac9a7641070d2a6a78c2f

URL: https://github.com/llvm/llvm-project/commit/a35480f85960feccc44ac9a7641070d2a6a78c2f
DIFF: https://github.com/llvm/llvm-project/commit/a35480f85960feccc44ac9a7641070d2a6a78c2f.diff

LOG: [llvm-exegesis] Fix missing-headers build errors.

Details:

Switch all #includes to use <> because that is consistent with what happens in the cmake checks.
Otherwise, we could be in the situation where cmake checks see that headers exist at <perfmon/...>
but in  llvm-exegesis code, we use "perfmon/...", which may not exist.

Related PR/revisions: D84076, PR51017+D105615

    Differential Revision: https://reviews.llvm.org/D105861

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/PerfHelper.cpp
    llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp b/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp
index 58e1f4dc2a2b2..8a0b399dc982b 100644
--- a/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp
+++ b/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp
@@ -12,9 +12,9 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/raw_ostream.h"
 #ifdef HAVE_LIBPFM
-#include "perfmon/perf_event.h"
-#include "perfmon/pfmlib.h"
-#include "perfmon/pfmlib_perf_event.h"
+#include <perfmon/perf_event.h>
+#include <perfmon/pfmlib.h>
+#include <perfmon/pfmlib_perf_event.h>
 #endif
 
 #include <cassert>

diff  --git a/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp b/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
index e5b490e02049d..3fee0e5d52599 100644
--- a/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
+++ b/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
@@ -8,19 +8,18 @@
 
 #include "X86Counter.h"
 
-#if defined(HAVE_LIBPFM) && defined(LIBPFM_HAS_FIELD_CYCLES)
+#if defined(__linux__) && 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__
+
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Errc.h"
 
-#ifdef HAVE_LIBPFM
-#include "perfmon/perf_event.h"
-#include "perfmon/pfmlib.h"
-#include "perfmon/pfmlib_perf_event.h"
-#endif // HAVE_LIBPFM
+#include <perfmon/perf_event.h>
+#include <perfmon/pfmlib.h>
+#include <perfmon/pfmlib_perf_event.h>
 
 #include <atomic>
 #include <chrono>
@@ -258,5 +257,5 @@ X86LbrCounter::doReadCounter(const void *From, const void *To) const {
 } // namespace exegesis
 } // namespace llvm
 
-#endif //  defined(HAVE_LIBPFM) && defined(LIBPFM_HAS_FIELD_CYCLES)
-#endif // __linux__
+#endif // defined(__linux__) && defined(HAVE_LIBPFM) &&
+       // defined(LIBPFM_HAS_FIELD_CYCLES)


        


More information about the llvm-commits mailing list