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

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 19:48:56 PDT 2023


lifengxiang1025 wrote:

> I think this is an issue with LLVM pipeline. Functions are marked as "use-sample-profile" at front end when compiling from C++ source code (At clang::ParseAST -> ... -> CodeGenModule::EmitGlobal), but when compiling LLVM bitcode, it will not go through the parser frontend, instead go directly to optimization passes, so no function attributes will be added to the existing ones from the bitcode. It is a design decision whether it should be allowed to add/override this (or any) attribute in the bitcode

Yeah. Another way is changing `F.hasFnAttribute("use-sample-profile")` to `F.hasFnAttribute("use-sample-profile") || BitCodeUseSampleProfile`. Add attribute may break design. How about it?

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


More information about the llvm-commits mailing list