[llvm] [PGO]add bitcode-use-sample-profile (PR #66178)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 14 09:18:52 PDT 2023


teresajohnson 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?

https://github.com/llvm/llvm-project/pull/66178


More information about the llvm-commits mailing list