================
@@ -1784,6 +1784,12 @@ defm debug_info_for_profiling :
BoolFOption<"debug-info-for-profiling",
PosFlag<SetTrue, [], [ClangOption, CC1Option],
"Emit extra debug info to make sample profile more accurate">,
NegFlag<SetFalse>>;
+def fprofile_generate_cold_function_coverage : Flag<["-"],
"fprofile-generate-cold-function-coverage">,
----------------
wlei-llvm wrote:
> I meant, why not just use `clang ... -mllvm
> -instrument-cold-function-coverage`? Is this a clang - only feature (i.e.
> rust can't use it?) Is it just for symmetry with the current PGO flags?
>
> (This is not a pushback, mainly curious. Also the patch would be quite
> smaller if you didn't need to pass through the flags from clang to llvm)
I see, thanks for the suggestion! We also need to link runtime
lib(`compiler_rt.profile.a`)
but yeah, I agree it's possible to pass directly to llvm and linker without
through clang. Then the full command line would be like
```
clang ... -mllvm -instrument-cold-function-coverage -mllvm
-instrument-sample-cold-function-path=<file-path> -mllvm
--pgo-function-entry-coverage
ld.lld ... --u__llvm_runtime_variable
.../lib/x86_64-unknown-linux-gnu/libclang_rt.profile.a
```
So yes, adding the clang driver flag is kind of to mirror current[ IRPGO
flags](https://fburl.com/na3cp3gn), for easy maintenance purpose(given that
`-fprofile-generate` doesn't work with `-fprofile-sample-use`) and also to
centralize the configuration for the convenience. IMO, the `compiler_rt` is
probably the main blocker here, I didn't find an easy way to bundle it with a
llvm flag.
Appreciate any further suggestions!
https://github.com/llvm/llvm-project/pull/109837
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits