[clang] 44b2bd2 - [Docs][TySan] Correct optimisation remarks (#205577)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 15 02:01:28 PDT 2026
Author: Matthew Nagy
Date: 2026-09-15T10:01:23+01:00
New Revision: 44b2bd2ace3e43784256dccf7a755029fce71774
URL: https://github.com/llvm/llvm-project/commit/44b2bd2ace3e43784256dccf7a755029fce71774
DIFF: https://github.com/llvm/llvm-project/commit/44b2bd2ace3e43784256dccf7a755029fce71774.diff
LOG: [Docs][TySan] Correct optimisation remarks (#205577)
I think I got my wires crossed here between TySan and other sanitizers
when I was using their docs for reference on how to structure this file.
If a strict aliasing violation was going to cause problems, by the time
higher level optimizations come through and restructure the code, say by
removing a load/store, you no longer have the behaviour TySan would pick
up on.
Added:
Modified:
clang/docs/TypeSanitizer.md
Removed:
################################################################################
diff --git a/clang/docs/TypeSanitizer.md b/clang/docs/TypeSanitizer.md
index 28a1300dd0292..c346d443b8a4b 100644
--- a/clang/docs/TypeSanitizer.md
+++ b/clang/docs/TypeSanitizer.md
@@ -68,8 +68,9 @@ $ cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_
Compile and link your program with `-fsanitize=type` flag. The
TypeSanitizer run-time library should be linked to the final executable, so
-make sure to use `clang` (not `ld`) for the final link step. To
-get a reasonable performance add `-O1` or higher.
+make sure to use ``clang`` (not ``ld``) for the final link step. To increase performance, you can optimise with ``-O1``.
+Higher levels of optimization may result in certain strict type aliasing violations being optimized away
+(perhaps leading to unintended behavior). This results in the instrumentation giving users false-negatives.
TypeSanitizer by default doesn't print the full stack trace in error messages. Use `TYSAN_OPTIONS=print_stacktrace=1`
to print the full trace. To get nicer stack traces in error messages add `-fno-omit-frame-pointer` and
`-g`. To get perfect stack traces you may need to disable inlining (just use `-O1`) and tail call elimination
More information about the cfe-commits
mailing list