I'm asking for help for a problem with Clang Profile Guided Optimization. I'm using clang++-3.7, but the problem is still present with clang++-3.6.
If I try to do the PGO with a dummy code, everything's fine:
clang++ -o test -fprofile-instr-generate dummy.cpp
But with a bigger project there are some problems. I use a makefile and a script to automate the process, but this is the operations flow:
clang++ -c --std=c++0x -O3 -flto -fprofile-instr-generate src/foo1.cpp -o obj/foo1.o
clang++ -c --std=c++0x -O3 -flto -fprofile-instr-generate src/foo2.cpp -o obj/foo2.o
clang++ -c --std=c++0x -O3 -flto -fprofile-instr-generate src/foo3.cpp -o obj/foo3.o
clang++ -O3 -flto -fprofile-instr-generate obj/foo1.o obj/foo2.o obj/foo3.o -o foobar.out
Could anyone help me trying to understand where is the problem? Thank you in advance!
Solved. The problem was that the profiles are generated only in case of a normal exit (return or exit), while in my code the main ended with _exit.