[llvm] [NFCI] Clean up idempotent stack pop for inline context (PR #141544)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 26 22:05:34 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-pgo

Author: Mingming Liu (mingmingl-llvm)

<details>
<summary>Changes</summary>

In the top-of-tree, the stack pops at L414-416 [1] are no-op since there are prior stack pops at L400-402. 

[1] https://github.com/llvm/llvm-project/blame/e015626f189dc76f8df9fdc25a47638c6a2f3feb/llvm/lib/ProfileData/SampleProfReader.cpp#L414-L416
[2] https://github.com/llvm/llvm-project/blame/e015626f189dc76f8df9fdc25a47638c6a2f3feb/llvm/lib/ProfileData/SampleProfReader.cpp#L400-L402

---
Full diff: https://github.com/llvm/llvm-project/pull/141544.diff


1 Files Affected:

- (modified) llvm/lib/ProfileData/SampleProfReader.cpp (-3) 


``````````diff
diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index 343104ea25d1f..6466618aaa655 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -411,9 +411,6 @@ std::error_code SampleProfileReaderText::readImpl() {
         break;
       }
       case LineType::BodyProfile: {
-        while (InlineStack.size() > Depth) {
-          InlineStack.pop_back();
-        }
         FunctionSamples &FProfile = *InlineStack.back();
         for (const auto &name_count : TargetCountMap) {
           mergeSampleProfErrors(Result, FProfile.addCalledTargetSamples(

``````````

</details>


https://github.com/llvm/llvm-project/pull/141544


More information about the llvm-commits mailing list