[PATCH] D119735: [CSSPGO] Do not merge a context that is already duplicated into the base profile.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 10:01:03 PST 2022


hoy created this revision.
Herald added subscribers: ormris, modimo, wenlei, hiraditya.
hoy requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Do not merge a context that is already duplicated into the base profile.

Also fixing a typo caused by previous refactoring.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119735

Files:
  llvm/lib/ProfileData/SampleProfReader.cpp
  llvm/lib/Transforms/IPO/SampleProfile.cpp


Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1542,6 +1542,10 @@
       continue;
     }
 
+    // Do not merge a context that is already duplicated into the base profile.
+    if (FS->getContext().hasAttribute(sampleprof::ContextDuplicatedIntoBase))
+      continue;
+
     if (ProfileMergeInlinee) {
       // A function call can be replicated by optimizations like callsite
       // splitting or jump threading and the replicates end up sharing the
Index: llvm/lib/ProfileData/SampleProfReader.cpp
===================================================================
--- llvm/lib/ProfileData/SampleProfReader.cpp
+++ llvm/lib/ProfileData/SampleProfReader.cpp
@@ -656,7 +656,7 @@
     if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagFullContext))
       FunctionSamples::ProfileIsCSFlat = ProfileIsCSFlat = true;
     if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagIsCSNested))
-      FunctionSamples::ProfileIsCSNested = ProfileIsCSNested;
+      FunctionSamples::ProfileIsCSNested = ProfileIsCSNested = true;
     if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagFSDiscriminator))
       FunctionSamples::ProfileIsFS = ProfileIsFS = true;
     break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119735.408477.patch
Type: text/x-patch
Size: 1328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220214/1bce71b7/attachment.bin>


More information about the llvm-commits mailing list