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(" \t\v\f\r"); + PSL.add(SanitizedSymbol); + } } static void handleExtBinaryWriter(sampleprof::SampleProfileWriter &Writer,