[llvm] [PGO]add bitcode-use-sample-profile (PR #66178)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 14 19:14:12 PDT 2023
lifengxiang1025 wrote:
> > @teresajohnson @WenleiHe @htyu @huangjd Sorry for implicit description. For example, I have foo.cpp and bar.cpp and steps as follow:
> > ```
> > 1. clang++ -c foo.cpp -flto=thin -o foo.o
> > clang++ -c bar.cpp -flto=thin -o bar.o
> > 2. ar libtest.a foo.o bar.o
> > 3. ar x libtest.a
> > 4. clang++ -x ir foo.o -flto=thin -fprofile-sample-use=xxx -o foo.o.o
> > clang++ -x ir bar.o -flto=thin -fprofile-sample-use=xxx -o bar.o.o
> > 5. thinlink->thinbackend->final link
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > In step 4. Because function doesn't have attribute "use-sample-profile". It can't do pgo's optimation. Only if in step1, add flags "-fprofile-sample-use=xxx". Function could have attribute "use-sample-profile". This example happens when project use some third party libraries. I want to compile those third party libraries to bitcode archive and then do some optimation like pgo and thinlto.
>
> To confirm my understanding, are you saying that you are not doing steps 1 and 2 yourself, but are using an archive of ThinLTO bitcode distributed by a third party?
I do steps 1,2 and other steps separately. Many third party projects use build tool different from mine, such as cmake,make,autoreconf. It's difficult to migrate third party projects in my project. So I want to do 1,2 steps as apt(advanced package tool) and do 3,4,5 steps in my build system.
https://github.com/llvm/llvm-project/pull/66178
More information about the llvm-commits
mailing list