Skip to content

Commit 1ba7c7a

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.4
1 parent 8d5f280 commit 1ba7c7a

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2976,8 +2976,7 @@ void RewriteInstance::selectFunctionsToProcess() {
29762976
populateFunctionNames(opts::FunctionNamesFileNR, opts::ForceFunctionNamesNR);
29772977

29782978
// Make a set of functions to process to speed up lookups.
2979-
std::unordered_set<std::string> ForceFunctionsNR(
2980-
opts::ForceFunctionNamesNR.begin(), opts::ForceFunctionNamesNR.end());
2979+
StringSet<> ForceFunctionsNR(opts::ForceFunctionNamesNR);
29812980

29822981
if ((!opts::ForceFunctionNames.empty() ||
29832982
!opts::ForceFunctionNamesNR.empty()) &&
@@ -3051,9 +3050,10 @@ void RewriteInstance::selectFunctionsToProcess() {
30513050
return true;
30523051

30533052
// Non-regex check (-funcs-no-regex and -funcs-file-no-regex).
3054-
for (const StringRef Name : Function.getNames())
3055-
if (ForceFunctionsNR.count(Name.str()))
3056-
return true;
3053+
if (Function.forEachName([&](StringRef Name) {
3054+
return ForceFunctionsNR.contains(NameResolver::restore(Name));
3055+
}))
3056+
return true;
30573057

30583058
return false;
30593059
}

bolt/test/X86/funcs-no-regex.s

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Checks handling of function names passed via -funcs-no-regex
2+
3+
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
4+
# RUN: ld.lld %t.o -o %t.exe -nostdlib
5+
# RUN: llvm-bolt %t.exe -o %t.out -funcs-no-regex=func -print-cfg | FileCheck %s
6+
# CHECK: Binary Function "func/1"
7+
8+
.globl _start
9+
.type _start, @function
10+
_start:
11+
ret
12+
.size _start, .-_start
13+
14+
.type func, @function
15+
func:
16+
ud2

0 commit comments

Comments
 (0)