[clang-tools-extra] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 25 13:56:12 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 618a22144db5e45da8c95dc22064103e1b5e5b71 5cc1ae6b84361282c707a7789a512d0fd2a3b358 -- llvm/include/llvm/ProfileData/ProfileFuncRef.h llvm/include/llvm/ProfileData/SampleProf.h llvm/include/llvm/ProfileData/SampleProfReader.h llvm/include/llvm/ProfileData/SampleProfWriter.h llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h llvm/include/llvm/Transforms/IPO/SampleContextTracker.h llvm/lib/ProfileData/SampleProf.cpp llvm/lib/ProfileData/SampleProfReader.cpp llvm/lib/ProfileData/SampleProfWriter.cpp llvm/lib/Target/X86/X86InsertPrefetch.cpp llvm/lib/Transforms/IPO/SampleContextTracker.cpp llvm/lib/Transforms/IPO/SampleProfile.cpp llvm/tools/llvm-profdata/llvm-profdata.cpp llvm/tools/llvm-profgen/CSPreInliner.cpp llvm/tools/llvm-profgen/CSPreInliner.h llvm/tools/llvm-profgen/ProfileGenerator.cpp llvm/tools/llvm-profgen/ProfiledBinary.cpp llvm/tools/llvm-profgen/ProfiledBinary.h llvm/unittests/ProfileData/SampleProfTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index 1604b737e336..7dbe39084a07 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -305,7 +305,7 @@ struct LineLocation {
   }
 
   uint64_t getHashCode() const {
-    return ((uint64_t) Discriminator << 32) | LineOffset;
+    return ((uint64_t)Discriminator << 32) | LineOffset;
   }
 
   uint32_t LineOffset;
@@ -538,14 +538,14 @@ public:
         assert(!Name.empty() && "Name is empty");
       }
 
-  SampleContext(ProfileFuncRef Name)
-      : Name(Name), State(UnknownContext), Attributes(ContextNone) {}
+      SampleContext(ProfileFuncRef Name)
+          : Name(Name), State(UnknownContext), Attributes(ContextNone) {}
 
-  SampleContext(SampleContextFrames Context,
-                ContextStateMask CState = RawContext)
-      : Attributes(ContextNone) {
-    assert(!Context.empty() && "Context is empty");
-    setContext(Context, CState);
+      SampleContext(SampleContextFrames Context,
+                    ContextStateMask CState = RawContext)
+          : Attributes(ContextNone) {
+        assert(!Context.empty() && "Context is empty");
+        setContext(Context, CState);
   }
 
   // Give a context string, decode and populate internal states like
@@ -591,8 +591,7 @@ public:
 
   // Decode context string for a frame to get function name and location.
   // `ContextStr` is in the form of `FuncName:StartLine.Discriminator`.
-  static void decodeContextString(StringRef ContextStr,
-                                  ProfileFuncRef &FName,
+  static void decodeContextString(StringRef ContextStr, ProfileFuncRef &FName,
                                   LineLocation &LineLoc) {
     // Get function name
     auto EntrySplit = ContextStr.split(':');
@@ -792,8 +791,7 @@ public:
 
   sampleprof_error addCalledTargetSamples(uint32_t LineOffset,
                                           uint32_t Discriminator,
-                                          ProfileFuncRef FName,
-                                          uint64_t Num,
+                                          ProfileFuncRef FName, uint64_t Num,
                                           uint64_t Weight = 1) {
     return BodySamples[LineLocation(LineOffset, Discriminator)].addCalledTarget(
         FName, Num, Weight);
@@ -1069,9 +1067,7 @@ public:
   }
 
   /// Set the name of the function.
-  void setName(ProfileFuncRef FunctionName) {
-    Context.setName(FunctionName);
-  }
+  void setName(ProfileFuncRef FunctionName) { Context.setName(FunctionName); }
 
   /// Return the function name.
   ProfileFuncRef getName() const { return Context.getName(); }
@@ -1207,9 +1203,7 @@ public:
 
   /// Return the GUID of the context's name. If the context is already using
   /// MD5, don't hash it again.
-  uint64_t getGUID() const {
-    return getName().getHashCode();
-  }
+  uint64_t getGUID() const { return getName().getHashCode(); }
 
   // Find all the names in the current FunctionSamples including names in
   // all the inline instances and names of call targets.
diff --git a/llvm/include/llvm/ProfileData/SampleProfReader.h b/llvm/include/llvm/ProfileData/SampleProfReader.h
index 0f1ad8c4660e..ac006664accb 100644
--- a/llvm/include/llvm/ProfileData/SampleProfReader.h
+++ b/llvm/include/llvm/ProfileData/SampleProfReader.h
@@ -591,9 +591,7 @@ public:
 
   /// It includes all the names that have samples either in outline instance
   /// or inline instance.
-  std::vector<ProfileFuncRef> *getNameTable() override {
-    return &NameTable;
-  }
+  std::vector<ProfileFuncRef> *getNameTable() override { return &NameTable; }
 
 protected:
   /// Read a numeric value of type T from the profile.
diff --git a/llvm/include/llvm/ProfileData/SampleProfWriter.h b/llvm/include/llvm/ProfileData/SampleProfWriter.h
index 3eff17e5e5f0..7c9f80cdafb2 100644
--- a/llvm/include/llvm/ProfileData/SampleProfWriter.h
+++ b/llvm/include/llvm/ProfileData/SampleProfWriter.h
@@ -196,7 +196,9 @@ public:
   std::error_code writeSample(const FunctionSamples &S) override;
 
 protected:
-  virtual MapVector<ProfileFuncRef, uint32_t> &getNameTable() { return NameTable; }
+  virtual MapVector<ProfileFuncRef, uint32_t> &getNameTable() {
+    return NameTable;
+  }
   virtual std::error_code writeMagicIdent(SampleProfileFormat Format);
   virtual std::error_code writeNameTable();
   std::error_code writeHeader(const SampleProfileMap &ProfileMap) override;
diff --git a/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h b/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
index b57505861421..fef1d55931f8 100644
--- a/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
+++ b/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
@@ -53,8 +53,8 @@ struct ProfiledCallGraphNode {
   using iterator = edges::iterator;
   using const_iterator = edges::const_iterator;
 
-  ProfiledCallGraphNode(ProfileFuncRef FName = ProfileFuncRef()) : Name(FName)
-  {}
+  ProfiledCallGraphNode(ProfileFuncRef FName = ProfileFuncRef())
+      : Name(FName) {}
 
   ProfileFuncRef Name;
   edges Edges;
diff --git a/llvm/include/llvm/Transforms/IPO/SampleContextTracker.h b/llvm/include/llvm/Transforms/IPO/SampleContextTracker.h
index 270dd25672b9..b701b26eb6b6 100644
--- a/llvm/include/llvm/Transforms/IPO/SampleContextTracker.h
+++ b/llvm/include/llvm/Transforms/IPO/SampleContextTracker.h
@@ -46,7 +46,8 @@ public:
   ContextTrieNode *getOrCreateChildContext(const LineLocation &CallSite,
                                            ProfileFuncRef ChildName,
                                            bool AllowCreate = true);
-  void removeChildContext(const LineLocation &CallSite, ProfileFuncRef ChildName);
+  void removeChildContext(const LineLocation &CallSite,
+                          ProfileFuncRef ChildName);
   std::map<uint64_t, ContextTrieNode> &getAllChildContext();
   ProfileFuncRef getFuncName() const;
   FunctionSamples *getFunctionSamples() const;
@@ -141,7 +142,8 @@ public:
       return nullptr;
     return I->second;
   }
-  std::unordered_map<ProfileFuncRef, ContextSamplesTy> &getFuncToCtxtProfiles() {
+  std::unordered_map<ProfileFuncRef, ContextSamplesTy> &
+  getFuncToCtxtProfiles() {
     return FuncToCtxtProfiles;
   }
 
diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index b539e27f0bd2..ccdb12465b55 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -405,10 +405,10 @@ std::error_code SampleProfileReaderText::readImpl() {
         }
         FunctionSamples &FProfile = *InlineStack.back();
         for (const auto &name_count : TargetCountMap) {
-          MergeResult(Result, FProfile.addCalledTargetSamples(
-                                  LineOffset, Discriminator,
-                                  ProfileFuncRef(name_count.first),
-                                  name_count.second));
+          MergeResult(Result,
+                      FProfile.addCalledTargetSamples(
+                          LineOffset, Discriminator,
+                          ProfileFuncRef(name_count.first), name_count.second));
         }
         MergeResult(Result, FProfile.addBodySamples(LineOffset, Discriminator,
                                                     NumSamples));
@@ -1238,8 +1238,7 @@ SampleProfileReaderExtBinaryBase::readFuncMetadata(bool ProfileHasAttribute,
         if (FProfile) {
           CalleeProfile = const_cast<FunctionSamples *>(
               &FProfile->functionSamplesAt(LineLocation(
-                  *LineOffset,
-                  *Discriminator))[FContext.getName()]);
+                  *LineOffset, *Discriminator))[FContext.getName()]);
         }
         if (std::error_code EC =
                 readFuncMetadata(ProfileHasAttribute, CalleeProfile))
@@ -1718,9 +1717,8 @@ std::error_code SampleProfileReaderGCC::readOneFunctionProfile(
         return sampleprof_error::truncated;
 
       if (Update)
-        FProfile->addCalledTargetSamples(LineOffset, Discriminator,
-                                         ProfileFuncRef(TargetName),
-                                         TargetCount);
+        FProfile->addCalledTargetSamples(
+            LineOffset, Discriminator, ProfileFuncRef(TargetName), TargetCount);
     }
   }
 
diff --git a/llvm/lib/ProfileData/SampleProfWriter.cpp b/llvm/lib/ProfileData/SampleProfWriter.cpp
index 1d5c811331cc..47acaf053b48 100644
--- a/llvm/lib/ProfileData/SampleProfWriter.cpp
+++ b/llvm/lib/ProfileData/SampleProfWriter.cpp
@@ -683,7 +683,8 @@ void SampleProfileWriterExtBinaryBase::addContext(
 }
 
 void SampleProfileWriterBinary::stablizeNameTable(
-    MapVector<ProfileFuncRef, uint32_t> &NameTable, std::set<ProfileFuncRef> &V) {
+    MapVector<ProfileFuncRef, uint32_t> &NameTable,
+    std::set<ProfileFuncRef> &V) {
   // Sort the names to make NameTable deterministic.
   for (const auto &I : NameTable)
     V.insert(I.first);
diff --git a/llvm/lib/Transforms/IPO/SampleContextTracker.cpp b/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
index 7bc692e4332f..3b49ce178dbb 100644
--- a/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
+++ b/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
@@ -488,9 +488,8 @@ ContextTrieNode *SampleContextTracker::getContextFor(const DILocation *DIL) {
     StringRef Name = PrevDIL->getScope()->getSubprogram()->getLinkageName();
     if (Name.empty())
       Name = PrevDIL->getScope()->getSubprogram()->getName();
-    S.push_back(
-        std::make_pair(FunctionSamples::getCallSiteIdentifier(DIL),
-                       getRepInFormat(Name)));
+    S.push_back(std::make_pair(FunctionSamples::getCallSiteIdentifier(DIL),
+                               getRepInFormat(Name)));
     PrevDIL = DIL;
   }
 
@@ -499,8 +498,7 @@ ContextTrieNode *SampleContextTracker::getContextFor(const DILocation *DIL) {
   StringRef RootName = PrevDIL->getScope()->getSubprogram()->getLinkageName();
   if (RootName.empty())
     RootName = PrevDIL->getScope()->getSubprogram()->getName();
-  S.push_back(std::make_pair(LineLocation(0, 0),
-                             getRepInFormat(RootName)));
+  S.push_back(std::make_pair(LineLocation(0, 0), getRepInFormat(RootName)));
 
   ContextTrieNode *ContextNode = &RootContext;
   int I = S.size();
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index e89913e27953..29dea47d05d3 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -475,10 +475,10 @@ private:
   void runOnFunction(const Function &F);
   void findIRAnchors(const Function &F,
                      std::map<LineLocation, StringRef> &IRAnchors);
-  void findProfileAnchors(
-      const FunctionSamples &FS,
-      std::map<LineLocation, std::unordered_set<ProfileFuncRef>>
-          &ProfileAnchors);
+  void
+  findProfileAnchors(const FunctionSamples &FS,
+                     std::map<LineLocation, std::unordered_set<ProfileFuncRef>>
+                         &ProfileAnchors);
   void countMismatchedSamples(const FunctionSamples &FS);
   void countProfileMismatches(
       const Function &F, const FunctionSamples &FS,
@@ -1646,8 +1646,7 @@ static SmallVector<InstrProfValueData, 2>
 GetSortedValueDataFromCallTargets(const SampleRecord::CallTargetMap &M) {
   SmallVector<InstrProfValueData, 2> R;
   for (const auto &I : SampleRecord::SortCallTargets(M)) {
-    R.emplace_back(
-        InstrProfValueData{I.first.getHashCode(), I.second});
+    R.emplace_back(InstrProfValueData{I.first.getHashCode(), I.second});
   }
   return R;
 }
@@ -1875,7 +1874,7 @@ SampleProfileLoader::buildProfiledCallGraph(Module &M) {
     if (F.isDeclaration() || !F.hasFnAttribute("use-sample-profile"))
       continue;
     ProfiledCG->addProfiledFunction(
-          getRepInFormat(FunctionSamples::getCanonicalFnName(F)));
+        getRepInFormat(FunctionSamples::getCanonicalFnName(F)));
   }
 
   return ProfiledCG;
@@ -2284,8 +2283,10 @@ void SampleProfileMatcher::countProfileCallsiteMismatches(
   }
 }
 
-void SampleProfileMatcher::findProfileAnchors(const FunctionSamples &FS,
-    std::map<LineLocation, std::unordered_set<ProfileFuncRef>> &ProfileAnchors) {
+void SampleProfileMatcher::findProfileAnchors(
+    const FunctionSamples &FS,
+    std::map<LineLocation, std::unordered_set<ProfileFuncRef>>
+        &ProfileAnchors) {
   auto isInvalidLineOffset = [](uint32_t LineOffset) {
     return LineOffset & 0x8000;
   };
@@ -2295,8 +2296,8 @@ void SampleProfileMatcher::findProfileAnchors(const FunctionSamples &FS,
     if (isInvalidLineOffset(Loc.LineOffset))
       continue;
     for (const auto &I : I.second.getCallTargets()) {
-      auto Ret = ProfileAnchors.try_emplace(Loc,
-          std::unordered_set<ProfileFuncRef>());
+      auto Ret =
+          ProfileAnchors.try_emplace(Loc, std::unordered_set<ProfileFuncRef>());
       Ret.first->second.insert(I.first);
     }
   }
@@ -2307,8 +2308,8 @@ void SampleProfileMatcher::findProfileAnchors(const FunctionSamples &FS,
       continue;
     const auto &CalleeMap = I.second;
     for (const auto &I : CalleeMap) {
-      auto Ret = ProfileAnchors.try_emplace(Loc,
-          std::unordered_set<ProfileFuncRef>());
+      auto Ret =
+          ProfileAnchors.try_emplace(Loc, std::unordered_set<ProfileFuncRef>());
       Ret.first->second.insert(I.first);
     }
   }
@@ -2332,8 +2333,7 @@ void SampleProfileMatcher::findProfileAnchors(const FunctionSamples &FS,
 //   [1, 2, 3(foo), 4,  7,  8(bar), 9]
 // The output mapping: [2->3, 3->4, 5->7, 6->8, 7->9].
 void SampleProfileMatcher::runStaleProfileMatching(
-    const Function &F,
-    const std::map<LineLocation, StringRef> &IRAnchors,
+    const Function &F, const std::map<LineLocation, StringRef> &IRAnchors,
     const std::map<LineLocation, std::unordered_set<ProfileFuncRef>>
         &ProfileAnchors,
     LocToLocMap &IRToProfileLocationMap) {
@@ -2372,8 +2372,8 @@ void SampleProfileMatcher::runStaleProfileMatching(
     bool IsMatchedAnchor = false;
     // Match the anchor location in lexical order.
     if (!CalleeName.empty()) {
-      auto CandidateAnchors = CalleeToCallsitesMap.find(
-          getRepInFormat(CalleeName));
+      auto CandidateAnchors =
+          CalleeToCallsitesMap.find(getRepInFormat(CalleeName));
       if (CandidateAnchors != CalleeToCallsitesMap.end() &&
           !CandidateAnchors->second.empty()) {
         auto CI = CandidateAnchors->second.begin();
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 32718482296f..bb4aec065ba8 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -903,8 +903,8 @@ remapSamples(const sampleprof::FunctionSamples &Samples,
                           BodySample.second.getSamples());
     for (const auto &Target : BodySample.second.getCallTargets()) {
       Result.addCalledTargetSamples(BodySample.first.LineOffset,
-                                    MaskedDiscriminator,
-                                    Remapper(Target.first), Target.second);
+                                    MaskedDiscriminator, Remapper(Target.first),
+                                    Target.second);
     }
   }
   for (const auto &CallsiteSamples : Samples.getCallsiteSamples()) {
@@ -913,8 +913,7 @@ remapSamples(const sampleprof::FunctionSamples &Samples,
     for (const auto &Callsite : CallsiteSamples.second) {
       sampleprof::FunctionSamples Remapped =
           remapSamples(Callsite.second, Remapper, Error);
-      MergeResult(Error,
-                  Target[Remapped.getName()].merge(Remapped));
+      MergeResult(Error, Target[Remapped.getName()].merge(Remapped));
     }
   }
   return Result;
diff --git a/llvm/tools/llvm-profgen/ProfileGenerator.cpp b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
index f5f2bc0d800e..2a1d395cfb15 100644
--- a/llvm/tools/llvm-profgen/ProfileGenerator.cpp
+++ b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
@@ -585,8 +585,8 @@ void ProfileGenerator::populateBoundarySamplesWithProbesForAllFunctions(
           getLeafProfileAndAddTotalSamples(FrameVec, 0);
       FunctionProfile.addCalledTargetSamples(
           FrameVec.back().Location.LineOffset,
-          FrameVec.back().Location.Discriminator,
-          ProfileFuncRef(CalleeName), Count);
+          FrameVec.back().Location.Discriminator, ProfileFuncRef(CalleeName),
+          Count);
     }
   }
 }
@@ -599,8 +599,8 @@ FunctionSamples &ProfileGenerator::getLeafProfileAndAddTotalSamples(
       &getTopLevelFunctionProfile(FrameVec[0].FuncName.stringRef(Buffer));
   FunctionProfile->addTotalSamples(Count);
   if (Binary->usePseudoProbes()) {
-    const auto *FuncDesc = Binary->getFuncDescForGUID(
-          FunctionProfile->getName().getHashCode());
+    const auto *FuncDesc =
+        Binary->getFuncDescForGUID(FunctionProfile->getName().getHashCode());
     FunctionProfile->setFunctionHash(FuncDesc->FuncHash);
   }
 
@@ -619,8 +619,8 @@ FunctionSamples &ProfileGenerator::getLeafProfileAndAddTotalSamples(
     FunctionProfile = &Ret.first->second;
     FunctionProfile->addTotalSamples(Count);
     if (Binary->usePseudoProbes()) {
-      const auto *FuncDesc = Binary->getFuncDescForGUID(
-          FunctionProfile->getName().getHashCode());
+      const auto *FuncDesc =
+          Binary->getFuncDescForGUID(FunctionProfile->getName().getHashCode());
       FunctionProfile->setFunctionHash(FuncDesc->FuncHash);
     }
   }
@@ -901,16 +901,14 @@ void CSProfileGenerator::populateBoundarySamplesForFunction(
         CallerNode->getFunctionSamples()->addCalledTargetSamples(
             LeafLoc->Location.LineOffset,
             getBaseDiscriminator(LeafLoc->Location.Discriminator),
-            ProfileFuncRef(CalleeName),
-            Count);
+            ProfileFuncRef(CalleeName), Count);
         // Record head sample for called target(callee)
         CalleeCallSite = LeafLoc->Location;
       }
     }
 
-    ContextTrieNode *CalleeNode =
-        CallerNode->getOrCreateChildContext(CalleeCallSite,
-                                            ProfileFuncRef(CalleeName));
+    ContextTrieNode *CalleeNode = CallerNode->getOrCreateChildContext(
+        CalleeCallSite, ProfileFuncRef(CalleeName));
     FunctionSamples *CalleeProfile = getOrCreateFunctionSamples(CalleeNode);
     CalleeProfile->addHeadSamples(Count);
   }
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
index 00354286131b..b383a789066f 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -144,9 +144,8 @@ void BinarySizeContextTracker::trackInlineesOptimizedAway(
     for (auto &ProbeFrame : reverse(ProbeContext)) {
       StringRef CallerName = ProbeFrame.first;
       LineLocation CallsiteLoc(ProbeFrame.second, 0);
-      SizeContext =
-          SizeContext->getOrCreateChildContext(CallsiteLoc,
-                                               ProfileFuncRef(CallerName));
+      SizeContext = SizeContext->getOrCreateChildContext(
+          CallsiteLoc, ProfileFuncRef(CallerName));
     }
     // Add 0 size to make known.
     SizeContext->addFunctionSize(0);
@@ -833,7 +832,6 @@ void ProfiledBinary::loadSymbolsFromDWARF(ObjectFile &Obj) {
     WithColor::warning() << "Loading of DWARF info completed, but no binary "
                             "functions have been retrieved.\n";
 
-
   // Populate the hash binary function map for MD5 function name lookup. This
   // is done after BinaryFunctions are finalized.
   for (auto &BinaryFunction : BinaryFunctions) {
diff --git a/llvm/unittests/ProfileData/SampleProfTest.cpp b/llvm/unittests/ProfileData/SampleProfTest.cpp
index a13869d901bc..0ad2d2c1e3d4 100644
--- a/llvm/unittests/ProfileData/SampleProfTest.cpp
+++ b/llvm/unittests/ProfileData/SampleProfTest.cpp
@@ -179,8 +179,10 @@ struct SampleProfTest : ::testing::Test {
     // Test how reader/writer handles unmangled names.
     StringRef MconstructName("_M_construct<char *>");
     StringRef StringviewName("string_view<std::allocator<char> >");
-    BarSamples.addCalledTargetSamples(1, 0, ProfileFuncRef(MconstructName), 1000);
-    BarSamples.addCalledTargetSamples(1, 0, ProfileFuncRef(StringviewName), 437);
+    BarSamples.addCalledTargetSamples(1, 0, ProfileFuncRef(MconstructName),
+                                      1000);
+    BarSamples.addCalledTargetSamples(1, 0, ProfileFuncRef(StringviewName),
+                                      437);
 
     StringRef BazName("_Z3bazi");
     FunctionSamples BazSamples;
@@ -255,7 +257,8 @@ struct SampleProfTest : ::testing::Test {
     // inline instance for GooName. Test the correct FunctionSamples can be
     // found with Remapper support.
     const FunctionSamples *ReadGooSamples =
-        ReadFooSamples->findFunctionSamplesAt(LineLocation(7, 0), GooName.stringRef(Buffer),
+        ReadFooSamples->findFunctionSamplesAt(LineLocation(7, 0),
+                                              GooName.stringRef(Buffer),
                                               Reader->getRemapper());
     ASSERT_TRUE(ReadGooSamples != nullptr);
     ASSERT_EQ(502u, ReadGooSamples->getTotalSamples());
@@ -264,7 +267,8 @@ struct SampleProfTest : ::testing::Test {
     // no inline instance for GooName. Test no FunctionSamples will be
     // found with Remapper support.
     const FunctionSamples *ReadGooSamplesAgain =
-        ReadFooSamples->findFunctionSamplesAt(LineLocation(9, 0), GooName.stringRef(Buffer),
+        ReadFooSamples->findFunctionSamplesAt(LineLocation(9, 0),
+                                              GooName.stringRef(Buffer),
                                               Reader->getRemapper());
     ASSERT_TRUE(ReadGooSamplesAgain == nullptr);
 
@@ -273,7 +277,8 @@ struct SampleProfTest : ::testing::Test {
     // inline instance for HooName. Test the correct FunctionSamples can be
     // found with Remapper support.
     const FunctionSamples *ReadHooSamples =
-        ReadGooSamples->findFunctionSamplesAt(LineLocation(9, 0), HooName.stringRef(Buffer),
+        ReadGooSamples->findFunctionSamplesAt(LineLocation(9, 0),
+                                              HooName.stringRef(Buffer),
                                               Reader->getRemapper());
     ASSERT_TRUE(ReadHooSamples != nullptr);
     ASSERT_EQ(317u, ReadHooSamples->getTotalSamples());

``````````

</details>


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


More information about the cfe-commits mailing list