This is an archive of the discontinued LLVM Phabricator instance.

[llvm-exegesis] Fix compilation with old libpfm versions.
ClosedPublic

Authored by courbet on Jul 8 2021, 1:54 AM.

Details

Summary

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

Fixes PR51017.

Diff Detail

Event Timeline

courbet created this revision.Jul 8 2021, 1:54 AM
courbet requested review of this revision.Jul 8 2021, 1:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2021, 1:54 AM
oontvoo accepted this revision.Jul 11 2021, 7:00 PM

Thanks!

This revision is now accepted and ready to land.Jul 11 2021, 7:00 PM
oontvoo added inline comments.Jul 11 2021, 7:04 PM
llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
19–23

I'm not sure why this block isn't enough to prevent the inclusion of all libpfm stuff.
(AFAIK, LIBPFM_HAS_FIELD_CYCLES signals a subset of features whereas HAVE_LIBPFM tells you if the library exsits)

courbet added inline comments.Jul 11 2021, 10:41 PM
llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
19–23

The issue is only "perfmon/perf_event.h", which is what LIBPFM_HAS_FIELD_CYCLES tests: https://reviews.llvm.org/D84076

This revision was automatically updated to reflect the committed changes.