[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)
Zequan Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 19 10:33:16 PDT 2023
ZequanWu wrote:
> > I think there should be a proper Clang flag to control this, instead of requiring users to pass internal `-mllvm` flags. (Also the flag should be well documented.)
>
> I believe Zequan did that at one point, but he ran into the problem that Rust and Clang need to agree on the coverage metadata section flags. Using an mllvm flag means we can opt into the new mode for both clang and rust simultaneously, hopefully without waiting for rustc changes.
Since I modified clang CoverageMappingGen.cpp to conditionally add toggle this new mode in __llvm_profile_raw_version variable, rustc needs to do similar change at frontend in order to use this with code coverage.
The problem I ran into is chromium unittests have rust code. When I tried this mode for base_unittests, the Rust binaries are not able to use this mode while the C/C++ binaries uses it. So, the generated raw profiles are mixture of Rust raw profiles (counters + metadata sections) + C/C++ raw profiles (counters). llvm-profdata is currently not able to handle this.
My plan is to fix this in llvm-profdata later to allow merging with mixture raw profiles.
I'm not sure if we can pass -mllvm flag to rustc.
https://github.com/llvm/llvm-project/pull/69493
More information about the cfe-commits
mailing list