[llvm] Revert "[NFC][SampleFDO] In text sample prof reader, report dreport more concrete parsing errors for different line types" (PR #155121)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 23 14:43:49 PDT 2025


https://github.com/mingmingl-llvm created https://github.com/llvm/llvm-project/pull/155121

Reverts llvm/llvm-project#154885 to fix build bot failure (https://lab.llvm.org/buildbot/#/builders/144/builds/33611)

>From 5c51d41598ea16142a67812f647fcb7d301e0115 Mon Sep 17 00:00:00 2001
From: Mingming Liu <minglotus6 at gmail.com>
Date: Sat, 23 Aug 2025 14:43:13 -0700
Subject: [PATCH] =?UTF-8?q?Revert=20"[NFC][SampleFDO]=20In=20text=20sample?=
 =?UTF-8?q?=20prof=20reader,=20report=20dreport=20more=20conc=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This reverts commit 52b0e3f1ccd81198f285a4e90558ed2015dc1db3.
---
 llvm/lib/ProfileData/SampleProfReader.cpp | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index 15eb1d174d6fa..d147222fe2ce6 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -382,16 +382,9 @@ std::error_code SampleProfileReaderText::readImpl() {
       if (!ParseLine(*LineIt, LineTy, Depth, NumSamples, LineOffset,
                      Discriminator, FName, TargetCountMap, FunctionHash,
                      Attributes, IsFlat)) {
-        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);
-        }
+        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-commits mailing list