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 17
17
#include " llvm/IR/IRBuilder.h"
18
18
#include " llvm/IR/Module.h"
19
19
20
+ #include " llvm/Demangle/Demangle.h"
20
21
#include " llvm/Transforms/Instrumentation/RealtimeSanitizer.h"
21
22
22
23
using namespace llvm ;
@@ -53,7 +54,7 @@ static PreservedAnalyses rtsanPreservedCFGAnalyses() {
53
54
54
55
static void insertExpectNotRealtimeAtFunctionEntryPoint (Function &F) {
55
56
IRBuilder<> Builder (&F.front ().front ());
56
- Value *NameArg = Builder.CreateGlobalString (F.getName ());
57
+ Value *NameArg = Builder.CreateGlobalString (demangle ( F.getName () ));
57
58
58
59
FunctionType *FuncType =
59
60
FunctionType::get (Type::getVoidTy (F.getContext ()),
Original file line number Diff line number Diff line change 1
1
; RUN: opt < %s -passes=rtsan -S | FileCheck %s
2
2
3
- define void @blocking_function () #0 {
3
+ define void @_Z17blocking_functionv () #0 {
4
4
ret void
5
5
}
6
6
7
7
define noundef i32 @main () #2 {
8
- call void @blocking_function () #4
8
+ call void @_Z17blocking_functionv () #4
9
9
ret i32 0
10
10
}
11
11
12
12
attributes #0 = { mustprogress noinline sanitize_realtime_unsafe optnone ssp uwtable (sync) }
13
13
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