[all-commits] [llvm/llvm-project] 999886: [profile] Create only prof header when no counters

gulfemsavrun via All-commits all-commits at lists.llvm.org
Tue Aug 30 12:51:25 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 999886325e825747d5aff5c447b20d12fec7b57a
      https://github.com/llvm/llvm-project/commit/999886325e825747d5aff5c447b20d12fec7b57a
  Author: Gulfem Savrun Yeniceri <gulfem at google.com>
  Date:   2022-08-30 (Tue, 30 Aug 2022)

  Changed paths:
    M compiler-rt/lib/profile/InstrProfilingWriter.c
    A compiler-rt/test/profile/Posix/instrprof-empty-profile.c
    A compiler-rt/test/profile/Posix/instrprof-shared-empty-profile.test
    M llvm/lib/ProfileData/InstrProfReader.cpp

  Log Message:
  -----------
  [profile] Create only prof header when no counters

When we use selective instrumentation and instrument a file
that is not in the selected files list provided via -fprofile-list,
we generate an empty raw profile. This leads to empty_raw_profile
error when we try to read that profile. This patch fixes the issue by
generating a raw profile that contains only a profile header when
there are no counters and profile data.

A small reproducer for the above issue:
echo "src:other.cc" > code.list
clang++ -O2 -fprofile-instr-generate -fcoverage-mapping
-fprofile-list=code.list code.cc -o code
./code
llvm-profdata show default.profraw

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




More information about the All-commits mailing list