[llvm] [PGO]add bitcode-use-sample-profile (PR #66178)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 14 12:26:21 PDT 2023
teresajohnson wrote:
> > Also, if you are going to use an internal attribute, how about using the existing -mllvm -force-attribute=use-sample-profile. The ForceFunctionAttrs pass runs early in the ThinLTO pre-link pipeline, before sample pgo.
>
> `-force-attribute` needs a function name, like ` -force-attribute=foo:use-sample-profile`, so it is unfeasible to apply it to every function in the IR. Although it is quite easy to add support for wildcard like ` -force-attribute=*:use-sample-profile` and I think this sounds like an elegant solution
I haven't personally tried this option, but the documentation of the option indicates that if no function name is given the attribute gets applied to all functions in the module:
static cl::list<std::string> ForceAttributes(
"force-attribute", cl::Hidden,
cl::desc(
"Add an attribute to a function. This can be a "
"pair of 'function-name:attribute-name', to apply an attribute to a "
"specific function. For "
"example -force-attribute=foo:noinline. Specifying only an attribute "
"will apply the attribute to every function in the module. This "
"option can be specified multiple times."));
https://github.com/llvm/llvm-project/pull/66178
More information about the llvm-commits
mailing list