File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
lib/Transforms/Instrumentation
test/Instrumentation/RealtimeSanitizer Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1717#include " llvm/IR/IRBuilder.h"
1818#include " llvm/IR/Module.h"
1919
20+ #include " llvm/Demangle/Demangle.h"
2021#include " llvm/Transforms/Instrumentation/RealtimeSanitizer.h"
2122
2223using namespace llvm ;
@@ -53,7 +54,7 @@ static PreservedAnalyses rtsanPreservedCFGAnalyses() {
5354
5455static void insertExpectNotRealtimeAtFunctionEntryPoint (Function &F) {
5556 IRBuilder<> Builder (&F.front ().front ());
56- Value *NameArg = Builder.CreateGlobalString (F.getName ());
57+ Value *NameArg = Builder.CreateGlobalString (demangle ( F.getName () ));
5758
5859 FunctionType *FuncType =
5960 FunctionType::get (Type::getVoidTy (F.getContext ()),
Original file line number Diff line number Diff line change 11; RUN: opt < %s -passes=rtsan -S | FileCheck %s
22
3- define void @blocking_function () #0 {
3+ define void @_Z17blocking_functionv () #0 {
44 ret void
55}
66
77define noundef i32 @main () #2 {
8- call void @blocking_function () #4
8+ call void @_Z17blocking_functionv () #4
99 ret i32 0
1010}
1111
1212attributes #0 = { mustprogress noinline sanitize_realtime_unsafe optnone ssp uwtable (sync) }
1313
14- ; RealtimeSanitizer pass should insert __rtsan_expect_not_realtime at function entrypoint
15- ; CHECK-LABEL: @blocking_function()
16- ; CHECK-NEXT: call{{.*}}@__rtsan_expect_not_realtime({{ptr .*}})
14+ ; RealtimeSanitizer pass should create the demangled function name as a global string, and
15+ ; pass it as input to an inserted __rtsan_expect_not_realtime call at the function entrypoint
16+ ; CHECK: [[GLOBAL_STR:@[a-zA-Z0-9\.]+]]
17+ ; CHECK-SAME: c"blocking_function()\00"
18+ ; CHECK-LABEL: @_Z17blocking_functionv()
19+ ; CHECK-NEXT: call{{.*}}@__rtsan_expect_not_realtime(ptr{{.*}}[[GLOBAL_STR]])
You can’t perform that action at this time.
0 commit comments