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

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 22:44:13 PDT 2024


================
@@ -1267,6 +1272,8 @@ PreservedAnalyses AddressSanitizerPass::run(Module &M,
     Modified |= FunctionSanitizer.instrumentFunction(F, &TLI);
   }
   Modified |= ModuleSanitizer.instrumentModule(M);
+  if (Modified)
----------------
vitalybuka wrote:

we probably can set it right after 
```
 if (M.getModuleFlag("nosanitize_address"))
    return PreservedAnalyses::all();
```
or  we can endup with cases when some modules will be modified on first pass, other on a second. Unless we know a good reason, if the are multiple sanitizer in pipeline, only the first one is allowed to modify.

`return PreservedAnalyses::all();` should be fine even if we just added the flag.

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


More information about the llvm-commits mailing list