[clang] [clang][rtsan] Introduce realtime sanitizer codegen and driver (PR #102622)

Doug Wyatt via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 9 08:17:20 PDT 2024


================
@@ -845,6 +845,12 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
   if (SanOpts.has(SanitizerKind::ShadowCallStack))
     Fn->addFnAttr(llvm::Attribute::ShadowCallStack);
 
+  if (SanOpts.has(SanitizerKind::Realtime)) {
+    for (const FunctionEffectWithCondition &Fe : FD->getFunctionEffects())
+      if (Fe.Effect.kind() == FunctionEffect::Kind::NonBlocking)
+        Fn->addFnAttr(llvm::Attribute::SanitizeRealtime);
+  }
----------------
dougsonos wrote:

`getFunctionEffects()` is cheap, but when investigating the performance regression introduced by effects, it turned out to be worthwhile to test `Context.hasAnyFunctionEffects()` first, to optimize for the case of no effects ever having been seen.

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


More information about the cfe-commits mailing list