From 8f5a2325c39221efb6a0512639edb750ded62c44 Mon Sep 17 00:00:00 2001 From: Haohai Wen Date: Fri, 24 May 2024 09:03:53 +0800 Subject: [PATCH] [llvm-profgen] Trim tail CR+LF for LBR record line (#93210) On Windows, perfscript generated by sep contains CR+LF at the end of LBR records line. This '\r' will be treated as a LBR record when running llvm-profgen on Linux and then generate warning. --- llvm/tools/llvm-profgen/PerfReader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/tools/llvm-profgen/PerfReader.cpp b/llvm/tools/llvm-profgen/PerfReader.cpp index e9442027aed3fa..e63c6d61b3bfcc 100644 --- a/llvm/tools/llvm-profgen/PerfReader.cpp +++ b/llvm/tools/llvm-profgen/PerfReader.cpp @@ -552,7 +552,7 @@ bool PerfScriptReader::extractLBRStack(TraceStream &TraceIt, // ... 0x4005c8/0x4005dc/P/-/-/0 // It's in FIFO order and seperated by whitespace. SmallVector Records; - TraceIt.getCurrentLine().split(Records, " ", -1, false); + TraceIt.getCurrentLine().rtrim().split(Records, " ", -1, false); auto WarnInvalidLBR = [](TraceStream &TraceIt) { WithColor::warning() << "Invalid address in LBR record at line " << TraceIt.getLineNumber() << ": "