8
8
9
9
#include " ProfileGenerator.h"
10
10
#include " llvm/ProfileData/ProfileCommon.h"
11
+ #include < unordered_set>
11
12
12
13
static cl::opt<std::string> OutputFilename (" output" , cl::value_desc(" output" ),
13
14
cl::Required,
@@ -520,7 +521,8 @@ void PseudoProbeCSProfileGenerator::populateBodySamplesWithProbes(
520
521
// Extract the top frame probes by looking up each address among the range in
521
522
// the Address2ProbeMap
522
523
extractProbesFromRange (RangeCounter, ProbeCounter, Binary);
523
- std::unordered_map<MCDecodedPseudoProbeInlineTree *, FunctionSamples *>
524
+ std::unordered_map<MCDecodedPseudoProbeInlineTree *,
525
+ std::unordered_set<FunctionSamples *>>
524
526
FrameSamples;
525
527
for (auto PI : ProbeCounter) {
526
528
const MCDecodedPseudoProbe *Probe = PI.first ;
@@ -530,7 +532,7 @@ void PseudoProbeCSProfileGenerator::populateBodySamplesWithProbes(
530
532
// Record the current frame and FunctionProfile whenever samples are
531
533
// collected for non-danglie probes. This is for reporting all of the
532
534
// zero count probes of the frame later.
533
- FrameSamples[Probe->getInlineTreeNode ()] = &FunctionProfile;
535
+ FrameSamples[Probe->getInlineTreeNode ()]. insert ( &FunctionProfile) ;
534
536
FunctionProfile.addBodySamplesForProbe (Probe->getIndex (), Count);
535
537
FunctionProfile.addTotalSamples (Count);
536
538
if (Probe->isEntry ()) {
@@ -559,12 +561,13 @@ void PseudoProbeCSProfileGenerator::populateBodySamplesWithProbes(
559
561
FunctionProfile.getContext ().getNameWithoutContext (), Count);
560
562
}
561
563
}
564
+ }
562
565
563
- // Assign zero count for remaining probes without sample hits to
564
- // differentiate from probes optimized away, of which the counts are unknown
565
- // and will be inferred by the compiler.
566
- for (auto &I : FrameSamples) {
567
- auto *FunctionProfile = I.second ;
566
+ // Assign zero count for remaining probes without sample hits to
567
+ // differentiate from probes optimized away, of which the counts are unknown
568
+ // and will be inferred by the compiler.
569
+ for (auto &I : FrameSamples) {
570
+ for ( auto *FunctionProfile : I.second ) {
568
571
for (auto *Probe : I.first ->getProbes ()) {
569
572
FunctionProfile->addBodySamplesForProbe (Probe->getIndex (), 0 );
570
573
}
0 commit comments