resolve comments
diff --git a/llvm/test/tools/llvm-profgen/afdo-with-vtable-pie.test b/llvm/test/tools/llvm-profgen/afdo-with-vtable-pie.test
index b51cf33..56f888d 100644
--- a/llvm/test/tools/llvm-profgen/afdo-with-vtable-pie.test
+++ b/llvm/test/tools/llvm-profgen/afdo-with-vtable-pie.test
@@ -1,6 +1,5 @@
-
 RUN: llvm-profgen --perfscript=%p/Inputs/pie-lbr-perf.script \
-RUN: --data-access-profile=%p/Inputs/pie-dap-perf.txt  \
+RUN: --data-access-perftrace=%p/Inputs/pie-dap-perf.txt  \
 RUN: --binary=%p/Inputs/dap-pie.bin --format=text --pid=1725662 \
 RUN: -ignore-stack-samples -use-dwarf-correlation -o %t.afdo
 
diff --git a/llvm/test/tools/llvm-profgen/afdo-with-vtable.test b/llvm/test/tools/llvm-profgen/afdo-with-vtable.test
index 14d743c..65b601e4 100644
--- a/llvm/test/tools/llvm-profgen/afdo-with-vtable.test
+++ b/llvm/test/tools/llvm-profgen/afdo-with-vtable.test
@@ -1,4 +1,4 @@
-RUN: llvm-profgen --perfscript=%p/Inputs/lbr-perf-for-dap.script --data-access-profile=%p/Inputs/dap-perf-trace.txt \
+RUN: llvm-profgen --perfscript=%p/Inputs/lbr-perf-for-dap.script --data-access-perftrace=%p/Inputs/dap-perf-trace.txt \
 RUN:  --binary=%p/Inputs/dap.bin --format=text --pid=3446532 \
 RUN: -ignore-stack-samples -use-dwarf-correlation -o %t.afdo
 
diff --git a/llvm/tools/llvm-profgen/ProfileGenerator.cpp b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
index ef66160..41ed191 100644
--- a/llvm/tools/llvm-profgen/ProfileGenerator.cpp
+++ b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
@@ -539,22 +539,7 @@
   populateBodySamplesForAllFunctions(SC.RangeCounter);
   // Fill in boundary sample counts as well as call site samples for calls
   populateBoundarySamplesForAllFunctions(SC.BranchCounter);
-
-  // For each instruction with vtable accesses, get its symbolized inline
-  // stack, and add the vtable counters to the function samples.
-  for (const auto &[IpData, Count] : SC.DataAccessCounter) {
-    uint64_t InstAddr = IpData.first;
-    const SampleContextFrameVector &FrameVec =
-        Binary->getCachedFrameLocationStack(InstAddr, false);
-    if (!FrameVec.empty()) {
-      FunctionSamples &FunctionProfile =
-          getLeafProfileAndAddTotalSamples(FrameVec, 0);
-      LineLocation Loc(
-          FrameVec.back().Location.LineOffset,
-          getBaseDiscriminator(FrameVec.back().Location.Discriminator));
-      FunctionProfile.addTypeSamplesAt(Loc, FunctionId(IpData.second), Count);
-    }
-  }
+  populateTypeSamplesForAllFunctions(SC.DataAccessCounter);
 
   updateFunctionSamples();
 }
@@ -621,8 +606,8 @@
           getLeafProfileAndAddTotalSamples(FrameVec, 0);
       FunctionProfile.addCalledTargetSamples(
           FrameVec.back().Location.LineOffset,
-          FrameVec.back().Location.Discriminator,
-          FunctionId(CalleeName), Count);
+          FrameVec.back().Location.Discriminator, FunctionId(CalleeName),
+          Count);
     }
   }
 }
@@ -645,8 +630,7 @@
         getBaseDiscriminator(FrameVec[I - 1].Location.Discriminator));
     FunctionSamplesMap &SamplesMap =
         FunctionProfile->functionSamplesAt(Callsite);
-    auto Ret =
-        SamplesMap.emplace(FrameVec[I].Func, FunctionSamples());
+    auto Ret = SamplesMap.emplace(FrameVec[I].Func, FunctionSamples());
     if (Ret.second) {
       SampleContext Context(FrameVec[I].Func);
       Ret.first->second.setContext(Context);
@@ -761,6 +745,26 @@
   }
 }
 
+void ProfileGenerator::populateTypeSamplesForAllFunctions(
+    const DataAccessSample &DataAccessSamples) {
+  // For each instruction with vtable accesses, get its symbolized inline
+  // stack, and add the vtable counters to the function samples.
+  for (const auto &[IpData, Count] : DataAccessSamples) {
+    uint64_t InstAddr = IpData.first;
+    const SampleContextFrameVector &FrameVec =
+        Binary->getCachedFrameLocationStack(InstAddr,
+                                            /* UseProbeDiscriminator=*/false);
+    if (!FrameVec.empty()) {
+      FunctionSamples &FunctionProfile =
+          getLeafProfileAndAddTotalSamples(FrameVec, 0);
+      LineLocation Loc(
+          FrameVec.back().Location.LineOffset,
+          getBaseDiscriminator(FrameVec.back().Location.Discriminator));
+      FunctionProfile.addTypeSamplesAt(Loc, FunctionId(IpData.second), Count);
+    }
+  }
+}
+
 void ProfileGeneratorBase::calculateBodySamplesAndSize(
     const FunctionSamples &FSamples, uint64_t &TotalBodySamples,
     uint64_t &FuncBodySize) {
diff --git a/llvm/tools/llvm-profgen/ProfileGenerator.h b/llvm/tools/llvm-profgen/ProfileGenerator.h
index 5e361285..bafdc18 100644
--- a/llvm/tools/llvm-profgen/ProfileGenerator.h
+++ b/llvm/tools/llvm-profgen/ProfileGenerator.h
@@ -182,6 +182,8 @@
   populateBodySamplesWithProbesForAllFunctions(const RangeSample &RangeCounter);
   void populateBoundarySamplesWithProbesForAllFunctions(
       const BranchSample &BranchCounters);
+  void
+  populateTypeSamplesForAllFunctions(const DataAccessSample &DataAccessSamples);
   void postProcessProfiles();
   void trimColdProfiles(const SampleProfileMap &Profiles,
                         uint64_t ColdCntThreshold);
diff --git a/llvm/tools/llvm-profgen/llvm-profgen.cpp b/llvm/tools/llvm-profgen/llvm-profgen.cpp
index 7924844..d36e29e 100644
--- a/llvm/tools/llvm-profgen/llvm-profgen.cpp
+++ b/llvm/tools/llvm-profgen/llvm-profgen.cpp
@@ -68,8 +68,9 @@
     cl::cat(ProfGenCategory));
 
 static cl::opt<std::string> DataAccessProfileFilename(
-    "data-access-profile", cl::value_desc("data-access-profile"),
-    cl::desc("Path to the data access profile to be generated."),
+    "data-access-perftrace", cl::value_desc("data-access-perftrace"),
+    cl::desc("File path of a Linux perf raw trace (generated by `perf report "
+             "-D`) consisting of memory access events."),
     cl::cat(ProfGenCategory));
 
 extern cl::opt<bool> ShowDisassemblyOnly;