[llvm-branch-commits] [llvm] 846f7df - Revert "Revert "[NFC][SampleFDO] In text sample prof reader, report dreport m…"

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Aug 23 14:48:08 PDT 2025


Author: Mingming Liu
Date: 2025-08-23T14:48:06-07:00
New Revision: 846f7df0b717ff30ec160c399a90df1387ef0e5d

URL: https://github.com/llvm/llvm-project/commit/846f7df0b717ff30ec160c399a90df1387ef0e5d
DIFF: https://github.com/llvm/llvm-project/commit/846f7df0b717ff30ec160c399a90df1387ef0e5d.diff

LOG: Revert "Revert "[NFC][SampleFDO] In text sample prof reader, report dreport m…"

This reverts commit ebac9f4338592dbf83767ff229e6f219c73bb6b9.

Added: 
    

Modified: 
    llvm/lib/ProfileData/SampleProfReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index d147222fe2ce6..15eb1d174d6fa 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -382,9 +382,16 @@ std::error_code SampleProfileReaderText::readImpl() {
       if (!ParseLine(*LineIt, LineTy, Depth, NumSamples, LineOffset,
                      Discriminator, FName, TargetCountMap, FunctionHash,
                      Attributes, IsFlat)) {
-        reportError(LineIt.line_number(),
-                    "Expected 'NUM[.NUM]: NUM[ mangled_name:NUM]*', found " +
-                        *LineIt);
+        switch (LineTy) {
+        case LineType::Metadata:
+          reportError(LineIt.line_number(),
+                      "Cannot parse metadata: " + *LineIt);
+          break;
+        default:
+          reportError(LineIt.line_number(),
+                      "Expected 'NUM[.NUM]: NUM[ mangled_name:NUM]*', found " +
+                          *LineIt);
+        }
         return sampleprof_error::malformed;
       }
       if (LineTy != LineType::Metadata && Depth == DepthMetadata) {


        


More information about the llvm-branch-commits mailing list