Skip to content

Commit a270fdf

Browse files
[memprof] Simplify control flow in readMemProf (NFC) (#149764)
Now that readMemProf calls two helper functions handleAllocSite and handleCallSite, we can simplify the control flow. We don't need to use "continue" anymore.
1 parent 2aa1e54 commit a270fdf

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

llvm/lib/Transforms/Instrumentation/MemProfUse.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -653,20 +653,15 @@ static void readMemprof(Module &M, Function &F,
653653
// allocation context with the same leaf.
654654
if (AllocInfoIter != LocHashToAllocInfo.end() &&
655655
// Only consider allocations which support hinting.
656-
isAllocationWithHotColdVariant(CI->getCalledFunction(), TLI)) {
656+
isAllocationWithHotColdVariant(CI->getCalledFunction(), TLI))
657657
handleAllocSite(I, CI, InlinedCallStack, Ctx, ORE, MaxColdSize,
658658
AllocInfoIter->second, FullStackIdToAllocMatchInfo);
659-
continue;
660-
}
661-
662-
if (CallSitesIter == LocHashToCallSites.end())
663-
continue;
664-
665-
// Otherwise, add callsite metadata. If we reach here then we found the
666-
// instruction's leaf location in the callsites map and not the allocation
667-
// map.
668-
handleCallSite(I, CalledFunction, InlinedCallStack, CallSitesIter->second,
669-
M, MatchedCallSites);
659+
else if (CallSitesIter != LocHashToCallSites.end())
660+
// Otherwise, add callsite metadata. If we reach here then we found the
661+
// instruction's leaf location in the callsites map and not the
662+
// allocation map.
663+
handleCallSite(I, CalledFunction, InlinedCallStack,
664+
CallSitesIter->second, M, MatchedCallSites);
670665
}
671666
}
672667
}

0 commit comments

Comments
 (0)