Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions bolt/lib/Rewrite/RewriteInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2976,8 +2976,7 @@ void RewriteInstance::selectFunctionsToProcess() {
populateFunctionNames(opts::FunctionNamesFileNR, opts::ForceFunctionNamesNR);

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

if ((!opts::ForceFunctionNames.empty() ||
!opts::ForceFunctionNamesNR.empty()) &&
Expand Down Expand Up @@ -3051,9 +3050,10 @@ void RewriteInstance::selectFunctionsToProcess() {
return true;

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

return false;
}
Expand Down
16 changes: 16 additions & 0 deletions bolt/test/X86/funcs-no-regex.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Checks handling of function names passed via -funcs-no-regex

# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
# RUN: ld.lld %t.o -o %t.exe -nostdlib
# RUN: llvm-bolt %t.exe -o %t.out -funcs-no-regex=func -print-cfg | FileCheck %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use double dash for verbose options.

# CHECK: Binary Function "func/1"

.globl _start
.type _start, @function
_start:
ret
.size _start, .-_start

.type func, @function
func:
ud2