*/
std::map<uint64_t, BoundaryPoint> Boundaries;
- for (auto Item : Ranges) {
+ for (const auto &Item : Ranges) {
assert(Item.first.first <= Item.first.second &&
"Invalid instruction range");
auto &BeginPoint = Boundaries[Item.first.first];
uint64_t BeginAddress = UINT64_MAX;
int ZeroRangeDepth = 0;
uint64_t Count = 0;
- for (auto Item : Boundaries) {
+ for (const auto &Item : Boundaries) {
uint64_t Address = Item.first;
- BoundaryPoint &Point = Item.second;
+ const BoundaryPoint &Point = Item.second;
if (Point.BeginCount != UINT64_MAX) {
if (BeginAddress != UINT64_MAX)
DisjointRanges[{BeginAddress, Address - 1}] = Count;
// and initialize it with zero count, so it remains zero if doesn't hit any
// samples. This is to be consistent with compiler that interpret zero count
// as unexecuted(cold).
- for (auto I : RangeCounter) {
+ for (const auto &I : RangeCounter) {
uint64_t StartOffset = I.first.first;
for (const auto &Range : Binary->getRangesForOffset(StartOffset))
Ranges[{Range.first, Range.second - 1}] += 0;
void ProfileGenerator::populateBodySamplesForAllFunctions(
const RangeSample &RangeCounter) {
- for (auto Range : preprocessRangeCounter(RangeCounter)) {
+ for (const auto &Range : preprocessRangeCounter(RangeCounter)) {
uint64_t RangeBegin = Binary->offsetToVirtualAddr(Range.first.first);
uint64_t RangeEnd = Binary->offsetToVirtualAddr(Range.first.second);
uint64_t Count = Range.second;
void ProfileGenerator::populateBoundarySamplesForAllFunctions(
const BranchSample &BranchCounters) {
- for (auto Entry : BranchCounters) {
+ for (const auto &Entry : BranchCounters) {
uint64_t SourceOffset = Entry.first.first;
uint64_t TargetOffset = Entry.first.second;
uint64_t Count = Entry.second;
// Go through all the ranges in the CS counters, use the start of the range to
// look up the function it belongs and record the function range.
for (const auto &CI : SampleCounters) {
- for (auto Item : CI.second.RangeCounter) {
+ for (const auto &Item : CI.second.RangeCounter) {
// FIXME: Filter the bogus crossing function range.
uint64_t StartOffset = Item.first.first;
// Note that a function can be spilt into multiple ranges, so get all
}
}
- for (auto I : AggregatedRanges) {
+ for (const auto &I : AggregatedRanges) {
uint64_t StartOffset = I.first;
uint64_t EndOffset = I.second;
Binary->computeInlinedContextSizeForRange(StartOffset, EndOffset);
// for calculating count for each location.
RangeSample Ranges;
findDisjointRanges(Ranges, RangeCounter);
- for (auto Range : Ranges) {
+ for (const auto &Range : Ranges) {
uint64_t RangeBegin = Binary->offsetToVirtualAddr(Range.first.first);
uint64_t RangeEnd = Binary->offsetToVirtualAddr(Range.first.second);
uint64_t Count = Range.second;
SampleContextFrames ContextId, FunctionSamples &FunctionProfile,
const BranchSample &BranchCounters) {
- for (auto Entry : BranchCounters) {
+ for (const auto &Entry : BranchCounters) {
uint64_t SourceOffset = Entry.first.first;
uint64_t TargetOffset = Entry.first.second;
uint64_t Count = Entry.second;
std::unordered_map<MCDecodedPseudoProbeInlineTree *,
std::unordered_set<FunctionSamples *>>
FrameSamples;
- for (auto PI : ProbeCounter) {
+ for (const auto &PI : ProbeCounter) {
const MCDecodedPseudoProbe *Probe = PI.first;
uint64_t Count = PI.second;
FunctionSamples &FunctionProfile =
void CSProfileGenerator::populateBoundarySamplesWithProbes(
const BranchSample &BranchCounter, SampleContextFrames ContextStack) {
- for (auto BI : BranchCounter) {
+ for (const auto &BI : BranchCounter) {
uint64_t SourceOffset = BI.first.first;
uint64_t TargetOffset = BI.first.second;
uint64_t Count = BI.second;