[llvm] [BOLT] Match instrument-funcs-file entries against restored names (PR #208313)

YongKang Zhu via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 00:01:47 PDT 2026


================
@@ -674,7 +675,12 @@ Error Instrumentation::runOnFunctions(BinaryContext &BC) {
     if (HasInstrumentFuncsFilter) {
       bool Found = false;
       for (const StringRef Name : BF.getNames()) {
-        if (InstrumentFuncsSet.contains(Name)) {
+        // instrument-funcs-file could specify original mangled function names
+        // and BOLT will append a "/<id>" (or "/<file>/<id2>") suffix to a local
+        // function name. Match against restored (suffix-stripped) name too, so
+        // local functions specified in the file won't be silently skipped.
+        if (InstrumentFuncsSet.contains(Name) ||
+            InstrumentFuncsSet.contains(NameResolver::restore(Name))) {
----------------
yozhu wrote:

The name list could from function order file derived from non-BOLT profile data and contains plain mangled symbol names.  Appending `.*` will require expensive regex string match, while looking up listed name as it is and then its restored name (if previous lookup fails) will be two cheaper hash comparison. This is only for `--instrument-funcs-file` list.

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


More information about the llvm-commits mailing list