[llvm] [Sanitizer] Make sanitizer passes idempotent (PR #99439)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 08:56:35 PDT 2024


================
@@ -0,0 +1,56 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 5
+; This test checks in the second run, function is not instrumented again.
+; RUN: opt < %s -passes=asan,asan -S | FileCheck %s
----------------
skc7 wrote:

@nikic  Could something like below be done so that sanitizers don't confuse with just "nosanitize" flag?

Add module flag "nosanitize" with a key that is enum SanitizerKind (with all supported sanitizers listed in it), defined in common header file for sanitizers. So, before running the pass, query the "nosanitize" flag and check that corresponding key value is present, to check if the pass has previously instrumented the IR.

M.addModuleFlag(Module::ModFlagBehavior::Override, "nosanitize", **SanitizerKind::Address**);

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


More information about the llvm-commits mailing list