[clang] [hwasan] Don't instrument when PGO profile is collected (PR #86739)

Vitaly Buka via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 15:08:57 PDT 2024


vitalybuka wrote:

> > > why can't hwasan and PGO instrumentation coexist?
> > 
> > 
> > They can, but binary is like 5x times slower, on top of 10x slowdown of PGO instrumentation. (don't quote me on these numbers, they are from large but single benchmark, still it's very slow)
> 
> If it's usable as a configuration, I don't see why we should prevent this. It still may be useful to some people. Seems like this checking should be done at a build system level if you don't want some codebase to compile with this configuration.
> 

At the moment builds system can only disable HWASAN, there is no option to enabled HWASAN but drop the pass.

> > > and this seems like it should be an error at the clang driver level, instead of silently turning off one of the requested features
> > 
> > 
> > 
> > 1. We need -fsanitizer=hwaddress, for attributes and profile matching, and some special handling done in earlier passes.
> 
> Do you mean that if you want a hwasan/PGO optimized build, you want the corresponding PGO instrumented build to also use hwasan?

I want PGO optimized binary with HWASAN.
But I don't rely want collect PGO profile with HWASAN, because the process is very slow.

> 
> Doesn't PGO instrumentation/use happen before the sanitizer passes run?

Instrumentation/use happens before sanitizer pass.
This is why drooping the pass will still produce the same optimized binary.

> 
> > 2. We don't wan't users care about profile instrumentation/use difference.



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


More information about the cfe-commits mailing list