https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93401

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Just to summarize discussions we had.  I think we need to think through setup
where there are different build, train and pgo-buid machines and the
directories are not known in advance.

There -ffile-prefix-map for similar purpose and we could add
-fprofile-prefix-map. Or maybe only -fprofile-prefix since at least for uses I
have in mind the second part of map is going to be always empty.

I guess we could support the following simulated makefile run:

instrumented build
==================

 cd <buildir>
 mkdir lib1
 cd <lib1>
 gcc foo.c -o <buildir>/ibb1/foo.o -fprofile-prefix-map=<buildir>=
-fprofile-generate=/

this will stet up binary to produce /lib1#foo.gcda on startup.  At the
instrumentation time we can

training run
============

GCOV_PREFIX=<my_favorite_profile_directory_during_train> run_program
then tar contents of my_favorite_profile_directory_during_train

final build
===========

 untar profile data to <my_favorite_profile_directory_during_build>
 Possibly use gcov-tool merge to merge data from multiple machines.

 cd <buildir2>
 mkdir lib1
 gcc foo.c -o <buildir2>/ibb1/foo.o -fprofile-prefix-map=<buildir2>=
-fprofile-use=<my_favorite_profile_directory_during_build>

But it looks bit convoluted (especially passing the phony / to
-fprofile-generate), so easier solution would be welcome. In particular I am
not sure how llvmprofdata solve this problem

Reply via email to