[PATCH] D149361: [profiling] Improve error message for raw profile header mismatches

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 10:56:18 PDT 2023


paquette created this revision.
paquette added reviewers: aemerson, jroelofs, fhahn, zjaffal, phosek, gulfem.
Herald added subscribers: hoy, wlei, StephenFan, wenlei, hiraditya.
Herald added a project: All.
paquette requested review of this revision.
Herald added a project: LLVM.

When a user uses a mismatched clang + llvm-profdata, they didn't get a very informative error message. It would just say "unsupported version".

As a result, users are often confused as to what they are supposed to do and tend to assume that it's a bug in the profiling runtime.

This patch improves the error message by:

- Adding a new class of error (`raw_profile_version_mismatch`) to make it clear that, specifically, the *raw profile* version is unsupported because of a tool mismatch.

- Adding an error message that tells the user which raw profile version was encountered, which version was expected, and instructs them to align their tool versions.

To support this, this patch also updates `InstrProfError::take` to also propagate the optional error message.


https://reviews.llvm.org/D149361

Files:
  clang/lib/CodeGen/CodeGenPGO.cpp
  llvm/include/llvm/ProfileData/InstrProf.h
  llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
  llvm/lib/ProfileData/InstrProf.cpp
  llvm/lib/ProfileData/InstrProfReader.cpp
  llvm/test/tools/llvm-profdata/mismatched-raw-profile-header.test
  llvm/tools/llvm-profdata/llvm-profdata.cpp
  llvm/unittests/ProfileData/InstrProfTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149361.517644.patch
Type: text/x-patch
Size: 9865 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230427/dae20110/attachment.bin>


More information about the llvm-commits mailing list