[compiler-rt] [llvm] [TySan] Add option to outline instrumentation (PR #120582)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 18 02:21:09 PDT 2025


================
@@ -268,6 +327,64 @@ __tysan_check(void *addr, int size, tysan_type_descriptor *td, int flags) {
   }
 }
 
+extern "C" SANITIZER_INTERFACE_ATTRIBUTE void
+__tysan_check(void *addr, int size, tysan_type_descriptor *td, int flags) {
+  GET_CALLER_PC_BP_SP;
+  __tysan_check_internal(addr, size, td, flags, pc, bp, sp);
+}
+
+extern "C" SANITIZER_INTERFACE_ATTRIBUTE void
+__tysan_instrument_with_shadow_update(void *ptr, tysan_type_descriptor *td,
+                                      bool sanitizeFunction,
+                                      uint64_t accessSize, int flags) {
+  tysan_type_descriptor **shadowData = shadow_for(ptr);
+  tysan_type_descriptor *loadedTD = *shadowData;
+  bool shadowIsNull = loadedTD == nullptr;
+
+  // TODO, sanitizeFunction is known at compile time, so maybe this is split
+  // into two different functions
+  if (sanitizeFunction) {
+
----------------
fhahn wrote:

Can be an early exit?

```suggestion
  if (sanitizeFunction)
    return;
```

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


More information about the llvm-commits mailing list