[llvm-dev] InstrProf backward compatibility

Johan Engelen via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 18 05:37:05 PST 2015


Hi all,
  I am working on adding PGO to LDC (LLVM D Compiler). The current
implementation
1) uses LLVM's InstrProf pass to generate an instrumented executable
2) links to compiler-rt/lib/profile for the runtime functionality to write
a raw profile data file
3) uses llvm-profdata to merge profile data and convert from profraw to
profdata format
4) uses llvm::IndexedInstrProfReader to read-in the profdata file for the
2nd PGO compile pass

This all works well with LLVM 3.7. While testing this with LLVM trunk, I
run into a version compatibility problem between different versions of
LLVM: I made a local copy of the compiler-rt/lib/profile release_37 version
(with a few fixes for MSVC) and so steps 1,2, and 4 use LLVM trunk, but
step 2 uses an older version of compiler-rt/lib/profile. Apparently,
trunk's llvm-profdata cannot read raw profile data files generated by
compiler-rt 3.7. Is this intended? Is llvm-profdata's output also
incompatible between different versions of LLVM (InstrProfWriter/Reader are
not meant to be compatible across LLVM versions) ?

LDC is currently compatible with LLVM 3.5 up to trunk. To support PGO for
multiple LLVM versions (>= 3.7), I think that we will need to have a copy
of compiler-rt/lib/profile for each version of LLVM >= 3.7. We also need to
have a copy of llvm-profdata for each version of LLVM >= 3.7. We already do
this with the FileCheck utility and will not be a big problem.

Does that make sense? What do you advise?

Thanks very much for your comments,
  Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151218/05e0ac5a/attachment.html>


More information about the llvm-dev mailing list