[BOLT][NFC] Disambiguate sample as basic sample (#139350)

Sample is a general term covering both basic (IP) and branch (LBR)
profiles. Find and replace ambiguous uses of sample in a basic sample
sense.

Rename `RawBranchCount` into `RawSampleCount` reflecting its use for
both kinds of profile.

Rename `PF_LBR` profile type as `PF_BRANCH` reflecting non-LBR based
branch profiles (non-brstack SPE, synthesized brstack ETM/PT).

Follow-up to #137644.

Test Plan: NFC
diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h
index c237f4a..6f3b592 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -142,8 +142,8 @@
   /// Types of profile the function can use. Could be a combination.
   enum {
     PF_NONE = 0,     /// No profile.
-    PF_LBR = 1,      /// Profile is based on last branch records.
-    PF_SAMPLE = 2,   /// Non-LBR sample-based profile.
+    PF_BRANCH = 1,   /// Profile is based on branches or branch stacks.
+    PF_BASIC = 2,    /// Non-branch IP sample-based profile.
     PF_MEMEVENT = 4, /// Profile has mem events.
   };
 
@@ -392,7 +392,7 @@
   float ProfileMatchRatio{0.0f};
 
   /// Raw branch count for this function in the profile.
-  uint64_t RawBranchCount{0};
+  uint64_t RawSampleCount{0};
 
   /// Dynamically executed function bytes, used for density computation.
   uint64_t SampleCountInBytes{0};
@@ -1893,11 +1893,11 @@
 
   /// Return the raw profile information about the number of branch
   /// executions corresponding to this function.
-  uint64_t getRawBranchCount() const { return RawBranchCount; }
+  uint64_t getRawSampleCount() const { return RawSampleCount; }
 
   /// Set the profile data about the number of branch executions corresponding
   /// to this function.
-  void setRawBranchCount(uint64_t Count) { RawBranchCount = Count; }
+  void setRawSampleCount(uint64_t Count) { RawSampleCount = Count; }
 
   /// Return the number of dynamically executed bytes, from raw perf data.
   uint64_t getSampleCountInBytes() const { return SampleCountInBytes; }
diff --git a/bolt/include/bolt/Profile/DataAggregator.h b/bolt/include/bolt/Profile/DataAggregator.h
index c4ee75e..5eddd85 100644
--- a/bolt/include/bolt/Profile/DataAggregator.h
+++ b/bolt/include/bolt/Profile/DataAggregator.h
@@ -257,7 +257,8 @@
 
   /// Semantic actions - parser hooks to interpret parsed perf samples
   /// Register a sample (non-LBR mode), i.e. a new hit at \p Address
-  bool doSample(BinaryFunction &Func, const uint64_t Address, uint64_t Count);
+  bool doBasicSample(BinaryFunction &Func, const uint64_t Address,
+                     uint64_t Count);
 
   /// Register an intraprocedural branch \p Branch.
   bool doIntraBranch(BinaryFunction &Func, uint64_t From, uint64_t To,
diff --git a/bolt/include/bolt/Profile/DataReader.h b/bolt/include/bolt/Profile/DataReader.h
index 1b61173..80031f8 100644
--- a/bolt/include/bolt/Profile/DataReader.h
+++ b/bolt/include/bolt/Profile/DataReader.h
@@ -212,15 +212,16 @@
 /// Similar to BranchInfo, but instead of recording from-to address (an edge),
 /// it records the address of a perf event and the number of times samples hit
 /// this address.
-struct SampleInfo {
+struct BasicSampleInfo {
   Location Loc;
   int64_t Hits;
 
-  SampleInfo(Location Loc, int64_t Hits) : Loc(std::move(Loc)), Hits(Hits) {}
+  BasicSampleInfo(Location Loc, int64_t Hits)
+      : Loc(std::move(Loc)), Hits(Hits) {}
 
-  bool operator==(const SampleInfo &RHS) const { return Loc == RHS.Loc; }
+  bool operator==(const BasicSampleInfo &RHS) const { return Loc == RHS.Loc; }
 
-  bool operator<(const SampleInfo &RHS) const {
+  bool operator<(const BasicSampleInfo &RHS) const {
     if (Loc < RHS.Loc)
       return true;
 
@@ -229,18 +230,18 @@
 
   void print(raw_ostream &OS) const;
 
-  void mergeWith(const SampleInfo &SI);
+  void mergeWith(const BasicSampleInfo &SI);
 };
 
 /// Helper class to store samples recorded in the address space of a given
 /// function, analogous to FuncBranchData but for samples instead of branches.
-struct FuncSampleData {
-  typedef std::vector<SampleInfo> ContainerTy;
+struct FuncBasicSampleData {
+  typedef std::vector<BasicSampleInfo> ContainerTy;
 
   StringRef Name;
   ContainerTy Data;
 
-  FuncSampleData(StringRef Name, ContainerTy Data)
+  FuncBasicSampleData(StringRef Name, ContainerTy Data)
       : Name(Name), Data(std::move(Data)) {}
 
   /// Get the number of samples recorded in [Start, End)
@@ -308,7 +309,7 @@
   /// The last step is to infer edge counts based on BB execution count. Note
   /// this is the opposite of the LBR way, where we infer BB execution count
   /// based on edge counts.
-  void readSampleData(BinaryFunction &BF);
+  void readBasicSampleData(BinaryFunction &BF);
 
   /// Convert function-level branch data into instruction annotations.
   void convertBranchData(BinaryFunction &BF) const;
@@ -382,7 +383,8 @@
   /// Return mem data matching one of the names in \p FuncNames.
   FuncMemData *getMemDataForNames(const std::vector<StringRef> &FuncNames);
 
-  FuncSampleData *getFuncSampleData(const std::vector<StringRef> &FuncNames);
+  FuncBasicSampleData *
+  getFuncBasicSampleData(const std::vector<StringRef> &FuncNames);
 
   /// Return a vector of all FuncBranchData matching the list of names.
   /// Internally use fuzzy matching to match special names like LTO-generated
@@ -425,7 +427,7 @@
   }
 
   using NamesToBranchesMapTy = std::map<StringRef, FuncBranchData>;
-  using NamesToSamplesMapTy = std::map<StringRef, FuncSampleData>;
+  using NamesToBasicSamplesMapTy = std::map<StringRef, FuncBasicSampleData>;
   using NamesToMemEventsMapTy = std::map<StringRef, FuncMemData>;
   using FuncsToBranchesMapTy =
       std::unordered_map<const BinaryFunction *, FuncBranchData *>;
@@ -474,7 +476,7 @@
     return parseLocation(EndChar, EndNl, true);
   }
   ErrorOr<BranchInfo> parseBranchInfo();
-  ErrorOr<SampleInfo> parseSampleInfo();
+  ErrorOr<BasicSampleInfo> parseSampleInfo();
   ErrorOr<MemInfo> parseMemInfo();
   ErrorOr<bool> maybeParseNoLBRFlag();
   ErrorOr<bool> maybeParseBATFlag();
@@ -488,7 +490,7 @@
   unsigned Line{0};
   unsigned Col{0};
   NamesToBranchesMapTy NamesToBranches;
-  NamesToSamplesMapTy NamesToSamples;
+  NamesToBasicSamplesMapTy NamesToBasicSamples;
   NamesToMemEventsMapTy NamesToMemEvents;
   FuncsToBranchesMapTy FuncsToBranches;
   FuncsToMemDataMapTy FuncsToMemData;
diff --git a/bolt/include/bolt/Profile/ProfileYAMLMapping.h b/bolt/include/bolt/Profile/ProfileYAMLMapping.h
index a8c9f7a1..a8d9a15 100644
--- a/bolt/include/bolt/Profile/ProfileYAMLMapping.h
+++ b/bolt/include/bolt/Profile/ProfileYAMLMapping.h
@@ -230,8 +230,8 @@
 
 template <> struct ScalarBitSetTraits<PROFILE_PF> {
   static void bitset(IO &io, PROFILE_PF &value) {
-    io.bitSetCase(value, "lbr", BinaryFunction::PF_LBR);
-    io.bitSetCase(value, "sample", BinaryFunction::PF_SAMPLE);
+    io.bitSetCase(value, "lbr", BinaryFunction::PF_BRANCH);
+    io.bitSetCase(value, "sample", BinaryFunction::PF_BASIC);
     io.bitSetCase(value, "memevent", BinaryFunction::PF_MEMEVENT);
   }
 };
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index a7fecd0..6d9fb9d 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -473,7 +473,7 @@
     OS << "\n  Image       : 0x" << Twine::utohexstr(getImageAddress());
   if (ExecutionCount != COUNT_NO_PROFILE) {
     OS << "\n  Exec Count  : " << ExecutionCount;
-    OS << "\n  Branch Count: " << RawBranchCount;
+    OS << "\n  Sample Count: " << RawSampleCount;
     OS << "\n  Profile Acc : " << format("%.1f%%", ProfileMatchRatio * 100.0f);
   }
 
diff --git a/bolt/lib/Core/BinaryFunctionProfile.cpp b/bolt/lib/Core/BinaryFunctionProfile.cpp
index 726da6a..9409106 100644
--- a/bolt/lib/Core/BinaryFunctionProfile.cpp
+++ b/bolt/lib/Core/BinaryFunctionProfile.cpp
@@ -70,7 +70,7 @@
     return;
   }
 
-  if (!(getProfileFlags() & PF_LBR))
+  if (!(getProfileFlags() & PF_BRANCH))
     return;
 
   // If we have at least some branch data for the function indicate that it
diff --git a/bolt/lib/Passes/BinaryPasses.cpp b/bolt/lib/Passes/BinaryPasses.cpp
index d8628c6..420ffc8 100644
--- a/bolt/lib/Passes/BinaryPasses.cpp
+++ b/bolt/lib/Passes/BinaryPasses.cpp
@@ -1445,7 +1445,7 @@
     if (!Function.hasProfile())
       continue;
 
-    uint64_t SampleCount = Function.getRawBranchCount();
+    uint64_t SampleCount = Function.getRawSampleCount();
     TotalSampleCount += SampleCount;
 
     if (Function.hasValidProfile()) {
diff --git a/bolt/lib/Passes/MCF.cpp b/bolt/lib/Passes/MCF.cpp
index 77dea73..4f3a964 100644
--- a/bolt/lib/Passes/MCF.cpp
+++ b/bolt/lib/Passes/MCF.cpp
@@ -458,7 +458,7 @@
 Error EstimateEdgeCounts::runOnFunctions(BinaryContext &BC) {
   if (llvm::none_of(llvm::make_second_range(BC.getBinaryFunctions()),
                     [](const BinaryFunction &BF) {
-                      return BF.getProfileFlags() == BinaryFunction::PF_SAMPLE;
+                      return BF.getProfileFlags() == BinaryFunction::PF_BASIC;
                     }))
     return Error::success();
 
@@ -466,7 +466,7 @@
     runOnFunction(BF);
   };
   ParallelUtilities::PredicateTy SkipFunc = [&](const BinaryFunction &BF) {
-    return BF.getProfileFlags() != BinaryFunction::PF_SAMPLE;
+    return BF.getProfileFlags() != BinaryFunction::PF_BASIC;
   };
 
   ParallelUtilities::runOnEachFunction(
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index 420e8c4..9453784 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -568,11 +568,12 @@
   for (auto &BFI : BC.getBinaryFunctions()) {
     BinaryFunction &BF = BFI.second;
     if (FuncBranchData *FBD = getBranchData(BF)) {
-      BF.markProfiled(BinaryFunction::PF_LBR);
-      BF.RawBranchCount = FBD->getNumExecutedBranches();
-    } else if (FuncSampleData *FSD = getFuncSampleData(BF.getNames())) {
-      BF.markProfiled(BinaryFunction::PF_SAMPLE);
-      BF.RawBranchCount = FSD->getSamples();
+      BF.markProfiled(BinaryFunction::PF_BRANCH);
+      BF.RawSampleCount = FBD->getNumExecutedBranches();
+    } else if (FuncBasicSampleData *FSD =
+                   getFuncBasicSampleData(BF.getNames())) {
+      BF.markProfiled(BinaryFunction::PF_BASIC);
+      BF.RawSampleCount = FSD->getSamples();
     }
   }
 
@@ -627,8 +628,8 @@
   return OrigFunc->getOneName();
 }
 
-bool DataAggregator::doSample(BinaryFunction &OrigFunc, uint64_t Address,
-                              uint64_t Count) {
+bool DataAggregator::doBasicSample(BinaryFunction &OrigFunc, uint64_t Address,
+                                   uint64_t Count) {
   // To record executed bytes, use basic block size as is regardless of BAT.
   uint64_t BlockSize = 0;
   if (BinaryBasicBlock *BB = OrigFunc.getBasicBlockContainingOffset(
@@ -642,13 +643,13 @@
   // Attach executed bytes to parent function in case of cold fragment.
   Func.SampleCountInBytes += Count * BlockSize;
 
-  auto I = NamesToSamples.find(Func.getOneName());
-  if (I == NamesToSamples.end()) {
+  auto I = NamesToBasicSamples.find(Func.getOneName());
+  if (I == NamesToBasicSamples.end()) {
     bool Success;
     StringRef LocName = getLocationName(Func, BAT);
-    std::tie(I, Success) = NamesToSamples.insert(
-        std::make_pair(Func.getOneName(),
-                       FuncSampleData(LocName, FuncSampleData::ContainerTy())));
+    std::tie(I, Success) = NamesToBasicSamples.insert(std::make_pair(
+        Func.getOneName(),
+        FuncBasicSampleData(LocName, FuncBasicSampleData::ContainerTy())));
   }
 
   Address -= Func.getAddress();
@@ -1661,7 +1662,7 @@
       continue;
     }
 
-    doSample(*Func, PC, HitCount);
+    doBasicSample(*Func, PC, HitCount);
   }
   outs() << "PERF2BOLT: read " << NumTotalSamples << " samples\n";
 
@@ -2192,9 +2193,9 @@
       OutFile << " " << Entry.getKey();
     OutFile << "\n";
 
-    for (const auto &KV : NamesToSamples) {
-      const FuncSampleData &FSD = KV.second;
-      for (const SampleInfo &SI : FSD.Data) {
+    for (const auto &KV : NamesToBasicSamples) {
+      const FuncBasicSampleData &FSD = KV.second;
+      for (const BasicSampleInfo &SI : FSD.Data) {
         writeLocation(SI.Loc);
         OutFile << SI.Hits << "\n";
         ++BranchValues;
@@ -2267,8 +2268,8 @@
   for (const StringMapEntry<std::nullopt_t> &EventEntry : EventNames)
     EventNamesOS << LS << EventEntry.first().str();
 
-  BP.Header.Flags = opts::BasicAggregation ? BinaryFunction::PF_SAMPLE
-                                           : BinaryFunction::PF_LBR;
+  BP.Header.Flags = opts::BasicAggregation ? BinaryFunction::PF_BASIC
+                                           : BinaryFunction::PF_BRANCH;
 
   // Add probe inline tree nodes.
   YAMLProfileWriter::InlineTreeDesc InlineTree;
diff --git a/bolt/lib/Profile/DataReader.cpp b/bolt/lib/Profile/DataReader.cpp
index 9cc6eeb..198f7d8 100644
--- a/bolt/lib/Profile/DataReader.cpp
+++ b/bolt/lib/Profile/DataReader.cpp
@@ -103,20 +103,20 @@
   return ExecutedBranches;
 }
 
-void SampleInfo::mergeWith(const SampleInfo &SI) { Hits += SI.Hits; }
+void BasicSampleInfo::mergeWith(const BasicSampleInfo &SI) { Hits += SI.Hits; }
 
-void SampleInfo::print(raw_ostream &OS) const {
+void BasicSampleInfo::print(raw_ostream &OS) const {
   OS << Loc.IsSymbol << " " << Loc.Name << " " << Twine::utohexstr(Loc.Offset)
      << " " << Hits << "\n";
 }
 
-uint64_t FuncSampleData::getSamples(uint64_t Start, uint64_t End) const {
+uint64_t FuncBasicSampleData::getSamples(uint64_t Start, uint64_t End) const {
   assert(llvm::is_sorted(Data));
   struct Compare {
-    bool operator()(const SampleInfo &SI, const uint64_t Val) const {
+    bool operator()(const BasicSampleInfo &SI, const uint64_t Val) const {
       return SI.Loc.Offset < Val;
     }
-    bool operator()(const uint64_t Val, const SampleInfo &SI) const {
+    bool operator()(const uint64_t Val, const BasicSampleInfo &SI) const {
       return Val < SI.Loc.Offset;
     }
   };
@@ -128,21 +128,21 @@
   return Result;
 }
 
-uint64_t FuncSampleData::getSamples() const {
+uint64_t FuncBasicSampleData::getSamples() const {
   uint64_t Result = 0;
-  for (const SampleInfo &I : Data)
+  for (const BasicSampleInfo &I : Data)
     Result += I.Hits;
   return Result;
 }
 
-void FuncSampleData::bumpCount(uint64_t Offset, uint64_t Count) {
+void FuncBasicSampleData::bumpCount(uint64_t Offset, uint64_t Count) {
   auto Iter = Index.find(Offset);
   if (Iter == Index.end()) {
     Data.emplace_back(Location(true, Name, Offset), Count);
     Index[Offset] = Data.size() - 1;
     return;
   }
-  SampleInfo &SI = Data[Iter->second];
+  BasicSampleInfo &SI = Data[Iter->second];
   SI.Hits += Count;
 }
 
@@ -358,12 +358,12 @@
     return;
 
   if (!hasLBR()) {
-    BF.ProfileFlags = BinaryFunction::PF_SAMPLE;
-    readSampleData(BF);
+    BF.ProfileFlags = BinaryFunction::PF_BASIC;
+    readBasicSampleData(BF);
     return;
   }
 
-  BF.ProfileFlags = BinaryFunction::PF_LBR;
+  BF.ProfileFlags = BinaryFunction::PF_BRANCH;
 
   // Possibly assign/re-assign branch profile data.
   matchProfileData(BF);
@@ -414,12 +414,12 @@
   FuncBranchData *FBD = getBranchData(BF);
   if (FBD) {
     BF.ProfileMatchRatio = evaluateProfileData(BF, *FBD);
-    BF.RawBranchCount = FBD->getNumExecutedBranches();
+    BF.RawSampleCount = FBD->getNumExecutedBranches();
     if (BF.ProfileMatchRatio == 1.0f) {
       if (fetchProfileForOtherEntryPoints(BF)) {
         BF.ProfileMatchRatio = evaluateProfileData(BF, *FBD);
         BF.ExecutionCount = FBD->ExecutionCount;
-        BF.RawBranchCount = FBD->getNumExecutedBranches();
+        BF.RawSampleCount = FBD->getNumExecutedBranches();
       }
       return;
     }
@@ -561,8 +561,8 @@
   return MatchRatio;
 }
 
-void DataReader::readSampleData(BinaryFunction &BF) {
-  FuncSampleData *SampleDataOrErr = getFuncSampleData(BF.getNames());
+void DataReader::readBasicSampleData(BinaryFunction &BF) {
+  FuncBasicSampleData *SampleDataOrErr = getFuncBasicSampleData(BF.getNames());
   if (!SampleDataOrErr)
     return;
 
@@ -1013,7 +1013,7 @@
   return MemInfo(Offset, Addr, CountRes.get());
 }
 
-ErrorOr<SampleInfo> DataReader::parseSampleInfo() {
+ErrorOr<BasicSampleInfo> DataReader::parseSampleInfo() {
   ErrorOr<Location> Res = parseLocation(FieldSeparator);
   if (std::error_code EC = Res.getError())
     return EC;
@@ -1031,7 +1031,7 @@
     return make_error_code(llvm::errc::io_error);
   }
 
-  return SampleInfo(std::move(Address), Occurrences);
+  return BasicSampleInfo(std::move(Address), Occurrences);
 }
 
 ErrorOr<bool> DataReader::maybeParseNoLBRFlag() {
@@ -1088,11 +1088,11 @@
 
 std::error_code DataReader::parseInNoLBRMode() {
   auto GetOrCreateFuncEntry = [&](StringRef Name) {
-    auto I = NamesToSamples.find(Name);
-    if (I == NamesToSamples.end()) {
+    auto I = NamesToBasicSamples.find(Name);
+    if (I == NamesToBasicSamples.end()) {
       bool Success;
-      std::tie(I, Success) = NamesToSamples.insert(std::make_pair(
-          Name, FuncSampleData(Name, FuncSampleData::ContainerTy())));
+      std::tie(I, Success) = NamesToBasicSamples.insert(std::make_pair(
+          Name, FuncBasicSampleData(Name, FuncBasicSampleData::ContainerTy())));
 
       assert(Success && "unexpected result of insert");
     }
@@ -1111,11 +1111,11 @@
   };
 
   while (hasBranchData()) {
-    ErrorOr<SampleInfo> Res = parseSampleInfo();
+    ErrorOr<BasicSampleInfo> Res = parseSampleInfo();
     if (std::error_code EC = Res.getError())
       return EC;
 
-    SampleInfo SI = Res.get();
+    BasicSampleInfo SI = Res.get();
 
     // Ignore samples not involving known locations
     if (!SI.Loc.IsSymbol)
@@ -1140,8 +1140,8 @@
     I->second.Data.emplace_back(std::move(MI));
   }
 
-  for (auto &FuncSamples : NamesToSamples)
-    llvm::stable_sort(FuncSamples.second.Data);
+  for (auto &FuncBasicSamples : NamesToBasicSamples)
+    llvm::stable_sort(FuncBasicSamples.second.Data);
 
   for (auto &MemEvents : NamesToMemEvents)
     llvm::stable_sort(MemEvents.second.Data);
@@ -1321,7 +1321,7 @@
   if (getBranchData(Function) || getMemData(Function))
     return true;
 
-  if (getFuncSampleData(Function.getNames()) ||
+  if (getFuncBasicSampleData(Function.getNames()) ||
       getBranchDataForNames(Function.getNames()) ||
       getMemDataForNames(Function.getNames()))
     return true;
@@ -1357,9 +1357,10 @@
   return fetchMapEntry<NamesToMemEventsMapTy>(NamesToMemEvents, FuncNames);
 }
 
-FuncSampleData *
-DataReader::getFuncSampleData(const std::vector<StringRef> &FuncNames) {
-  return fetchMapEntry<NamesToSamplesMapTy>(NamesToSamples, FuncNames);
+FuncBasicSampleData *
+DataReader::getFuncBasicSampleData(const std::vector<StringRef> &FuncNames) {
+  return fetchMapEntry<NamesToBasicSamplesMapTy>(NamesToBasicSamples,
+                                                 FuncNames);
 }
 
 std::vector<FuncBranchData *> DataReader::getBranchDataForNamesRegex(
@@ -1399,11 +1400,11 @@
     StringRef Event = I->getKey();
     Diag << "Data was collected with event: " << Event << "\n";
   }
-  for (const auto &KV : NamesToSamples) {
+  for (const auto &KV : NamesToBasicSamples) {
     const StringRef Name = KV.first;
-    const FuncSampleData &FSD = KV.second;
+    const FuncBasicSampleData &FSD = KV.second;
     Diag << Name << " samples:\n";
-    for (const SampleInfo &SI : FSD.Data)
+    for (const BasicSampleInfo &SI : FSD.Data)
       Diag << SI.Loc.Name << " " << SI.Loc.Offset << " " << SI.Hits << "\n";
   }
 
diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index f5636bf..821f8c3 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -181,7 +181,7 @@
   for (const yaml::bolt::BinaryBasicBlockProfile &YamlBB : YamlBF.Blocks)
     for (const yaml::bolt::SuccessorInfo &YamlSI : YamlBB.Successors)
       FuncRawBranchCount += YamlSI.Count;
-  BF.setRawBranchCount(FuncRawBranchCount);
+  BF.setRawSampleCount(FuncRawBranchCount);
 
   if (BF.empty())
     return true;
@@ -221,7 +221,7 @@
 
     // Basic samples profile (without LBR) does not have branches information
     // and needs a special processing.
-    if (YamlBP.Header.Flags & BinaryFunction::PF_SAMPLE) {
+    if (YamlBP.Header.Flags & BinaryFunction::PF_BASIC) {
       if (!YamlBB.EventCount) {
         BB.setExecutionCount(0);
         continue;
@@ -338,7 +338,7 @@
     if (BB.getExecutionCount() == BinaryBasicBlock::COUNT_NO_PROFILE)
       BB.setExecutionCount(0);
 
-  if (YamlBP.Header.Flags & BinaryFunction::PF_SAMPLE)
+  if (YamlBP.Header.Flags & BinaryFunction::PF_BASIC)
     BF.setExecutionCount(FunctionExecutionCount);
 
   ProfileMatched &= !MismatchedBlocks && !MismatchedCalls && !MismatchedEdges;
diff --git a/bolt/lib/Profile/YAMLProfileWriter.cpp b/bolt/lib/Profile/YAMLProfileWriter.cpp
index 2bdc7b6..f1fe45f 100644
--- a/bolt/lib/Profile/YAMLProfileWriter.cpp
+++ b/bolt/lib/Profile/YAMLProfileWriter.cpp
@@ -215,7 +215,7 @@
   const MCPseudoProbeDecoder *PseudoProbeDecoder =
       opts::ProfileWritePseudoProbes ? BC.getPseudoProbeDecoder() : nullptr;
 
-  const uint16_t LBRProfile = BF.getProfileFlags() & BinaryFunction::PF_LBR;
+  const uint16_t LBRProfile = BF.getProfileFlags() & BinaryFunction::PF_BRANCH;
 
   // Prepare function and block hashes
   BF.computeHash(UseDFS);
diff --git a/bolt/test/X86/branch-data.test b/bolt/test/X86/branch-data.test
index 231a773..8ff2120 100644
--- a/bolt/test/X86/branch-data.test
+++ b/bolt/test/X86/branch-data.test
@@ -15,7 +15,7 @@
 CHECK:      IsSimple    : 1
 CHECK:      BB Count    : 5
 CHECK:      Exec Count  : 199
-CHECK:      Branch Count: 7689
+CHECK:      Sample Count: 7689
 CHECK:    }
 CHECK:    .LBB{{.*}}
 CHECK:      Exec Count : 199
diff --git a/bolt/test/X86/reader-stale-yaml-std.test b/bolt/test/X86/reader-stale-yaml-std.test
index 9abe042..a02928a 100644
--- a/bolt/test/X86/reader-stale-yaml-std.test
+++ b/bolt/test/X86/reader-stale-yaml-std.test
@@ -24,7 +24,7 @@
 CHECK:   IsSimple    : 1
 CHECK:   BB Count    : 18
 CHECK:   Exec Count  : 151
-CHECK:   Branch Count: 552
+CHECK:   Sample Count: 552
 CHECK: }
 ## Verify block counts.
 CHECK: .LBB00 (43 instructions, align : 1)
@@ -51,7 +51,7 @@
 CHECK:   IsSimple    : 1
 CHECK:   BB Count    : 5
 CHECK:   Exec Count  : 20
-CHECK:   Branch Count: 640
+CHECK:   Sample Count: 640
 CHECK: }
 ## Verify block counts.
 CHECK: .LBB01 (4 instructions, align : 1)
diff --git a/bolt/test/X86/reader-stale-yaml.test b/bolt/test/X86/reader-stale-yaml.test
index 7a9540c..4c6e9c2 100644
--- a/bolt/test/X86/reader-stale-yaml.test
+++ b/bolt/test/X86/reader-stale-yaml.test
@@ -47,7 +47,7 @@
 CHECK1:      IsSimple    : 1
 CHECK1:      BB Count    : 5
 CHECK1:      Exec Count  : 20
-CHECK1:      Branch Count: 640
+CHECK1:      Sample Count: 640
 CHECK1:    }
 
 ## Verify block counts.
@@ -95,7 +95,7 @@
 CHECK2:      IsSimple    : 1
 CHECK2:      BB Count    : 18
 CHECK2:      Exec Count  : 151
-CHECK2:      Branch Count: 552
+CHECK2:      Sample Count: 552
 
 ## Verify block counts.
 CHECK2:    .LBB00 (43 instructions, align : 1)
diff --git a/bolt/tools/merge-fdata/merge-fdata.cpp b/bolt/tools/merge-fdata/merge-fdata.cpp
index 864aa67..cfcb937 100644
--- a/bolt/tools/merge-fdata/merge-fdata.cpp
+++ b/bolt/tools/merge-fdata/merge-fdata.cpp
@@ -124,8 +124,8 @@
   if (!MergedHeader.Flags)
     MergedHeader.Flags = Header.Flags;
 
-  constexpr auto Mask = llvm::bolt::BinaryFunction::PF_LBR |
-                        llvm::bolt::BinaryFunction::PF_SAMPLE;
+  constexpr auto Mask = llvm::bolt::BinaryFunction::PF_BRANCH |
+                        llvm::bolt::BinaryFunction::PF_BASIC;
   if ((MergedHeader.Flags & Mask) != (Header.Flags & Mask)) {
     errs() << "ERROR: cannot merge LBR profile with non-LBR profile\n";
     exit(1);