[llvm] Rtsan/blocking 2 llvm pass (PR #109543)

Chris Apple via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 06:35:46 PDT 2024


================
@@ -45,6 +46,26 @@ static void insertCallAtAllFunctionExitPoints(Function &Fn,
         insertCallBeforeInstruction(Fn, I, InsertFnName);
 }
 
+static PreservedAnalyses rtsanPreservedCFGAnalyses() {
+  PreservedAnalyses PA;
+  PA.preserveSet<CFGAnalyses>();
+  return PA;
+}
+
+static void insertNotifyBlockingCallAtFunctionEntryPoint(Function &F) {
+  IRBuilder<> Builder(&F.front().front());
+  Value *NameArg = Builder.CreateGlobalString(demangle(F.getName()));
+
+  FunctionType *FuncType =
+      FunctionType::get(Type::getVoidTy(F.getContext()),
+                        {PointerType::getUnqual(F.getContext())}, false);
+
+  FunctionCallee Func = F.getParent()->getOrInsertFunction(
+      "__rtsan_notify_blocking_call", FuncType);
+
+  Builder.CreateCall(Func, {NameArg});
----------------
cjappl wrote:

In my prototype branch, you can see what the second one would look like here:

https://github.com/cjappl/llvm-project/pull/6/files#diff-a0897f69407ad91c84a9618026d8264f776688677e6a49e53164b9bf469f89afR28

I'm down for either approach, but I want to hear your thoughts on one over the other

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


More information about the llvm-commits mailing list