diff --git a/llvm/test/Transforms/SampleProfile/Inputs/profile-symbol-list.text b/llvm/test/Transforms/SampleProfile/Inputs/profile-symbol-list.text --- a/llvm/test/Transforms/SampleProfile/Inputs/profile-symbol-list.text +++ b/llvm/test/Transforms/SampleProfile/Inputs/profile-symbol-list.text @@ -7,4 +7,4 @@ _fini _init _start -main +main diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -661,8 +661,10 @@ StringRef Data = Buffer->getBuffer(); Data.split(SymbolVec, '\n', /*MaxSplit=*/-1, /*KeepEmpty=*/false); - for (StringRef symbol : SymbolVec) - PSL.add(symbol); + for (StringRef SymbolStr : SymbolVec) { + StringRef SanitizedSymbol = SymbolStr.trim(); + PSL.add(SanitizedSymbol); + } } static void handleExtBinaryWriter(sampleprof::SampleProfileWriter &Writer,