[compiler-rt] [rtsan][test] Prevent test check from being optimized out in LTO builds (PR #122524)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 16:13:00 PST 2025


ilovepi wrote:

> > @cjappl I guess there's a question here about what's being sanitized: the source program vs the optimized binary. So of the goal of RTsan is to find source level issues, then perhaps it should prevent inlining or other types of optimizations on instrumented functions. If we only care about what makes it into the binary, then the current approach is probably fine, but these and other tests may need to use tricks like this more liberally. We should also probably consider adding a buildbot config that tests LTO'd runtimes once the libunwind CMake patches land.
> 
> CC @davidtrevelyan to make sure I'm correctly speaking for us.
> 
> IMO we are sanitizing the optimized binary. If a malloc exists in source, but then is optimized out, that binary should be safe to run and should not crash. The sister approach (performance constraints attributes) shines on the source side of things, so I think we should lean in to our strength of testing the final product.

SGTM. I just wanted to make sure we're not going to make things harder for ourselves later, or silently start missing things we should be catching.


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


More information about the llvm-commits mailing list