[all-commits] [llvm/llvm-project] 17cfd2: [profiling] Improve error message for raw profile ...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Thu Apr 27 14:52:20 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 17cfd2e025cb3aa929ad219c6ed0974d6198bf5b
      https://github.com/llvm/llvm-project/commit/17cfd2e025cb3aa929ad219c6ed0974d6198bf5b
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2023-04-27 (Thu, 27 Apr 2023)

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

  Log Message:
  -----------
  [profiling] Improve error message for raw profile header mismatches

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.

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




More information about the All-commits mailing list