[llvm] [rtsan] Handle attributed IR function declarations (PR #169577)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 29 04:29:18 PST 2025
================
@@ -61,23 +61,21 @@ static void insertCallAtAllFunctionExitPoints(Function &Fn,
insertCallBeforeInstruction(Fn, I, InsertFnName, FunctionArgs);
}
-static PreservedAnalyses rtsanPreservedCFGAnalyses() {
- PreservedAnalyses PA;
- PA.preserveSet<CFGAnalyses>();
- return PA;
-}
+static void runSanitizeRealtime(Function &Fn) {
+ if (Fn.empty())
+ return;
----------------
davidtrevelyan wrote:
Thanks for the good idea. I hadn't looked before drafting this PR, but it appears like ASan solves it a similar way at one level higher - at the top level of the pass's `run` method: https://github.com/llvm/llvm-project/blob/f5742c4d540a20651a67de51e16242a52e5d4064/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp#L1318
ThreadSanitizer has a `bool` check for whether it should `sanitizeFunction`, which returns false if there are no calls in it. MemorySanitizer does the same thing as AddressSanitizer with a `continue` at the top level if the function is `.empty()`.
If you prefer the ASan/MSan semantics I'm very happy to switch to it 👍
https://github.com/llvm/llvm-project/pull/169577
More information about the llvm-commits
mailing list