diff --git a/llvm/include/llvm/ProfileData/MemProf.h b/llvm/include/llvm/ProfileData/MemProf.h
index bfd91407769bb..ae262060718a7 100644
--- a/llvm/include/llvm/ProfileData/MemProf.h
+++ b/llvm/include/llvm/ProfileData/MemProf.h
@@ -895,11 +895,12 @@ struct LinearFrameIdConverter {
// call stack array in the profile.
struct LinearCallStackIdConverter {
const unsigned char *CallStackBase;
- std::function FrameIdToFrame;
+ llvm::function_ref FrameIdToFrame;
LinearCallStackIdConverter() = delete;
- LinearCallStackIdConverter(const unsigned char *CallStackBase,
- std::function FrameIdToFrame)
+ LinearCallStackIdConverter(
+ const unsigned char *CallStackBase,
+ llvm::function_ref FrameIdToFrame)
: CallStackBase(CallStackBase), FrameIdToFrame(FrameIdToFrame) {}
std::vector operator()(LinearCallStackId LinearCSId) {
@@ -966,13 +967,14 @@ struct CallerCalleePairExtractor {
// The base address of the radix tree array.
const unsigned char *CallStackBase;
// A functor to convert a linear FrameId to a Frame.
- std::function FrameIdToFrame;
+ llvm::function_ref FrameIdToFrame;
// A map from caller GUIDs to lists of call sites in respective callers.
DenseMap> CallerCalleePairs;
CallerCalleePairExtractor() = delete;
- CallerCalleePairExtractor(const unsigned char *CallStackBase,
- std::function FrameIdToFrame)
+ CallerCalleePairExtractor(
+ const unsigned char *CallStackBase,
+ llvm::function_ref FrameIdToFrame)
: CallStackBase(CallStackBase), FrameIdToFrame(FrameIdToFrame) {}
void operator()(LinearCallStackId LinearCSId) {
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index 54a7dea59b1ae..5a2a3352c4b07 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -1688,10 +1688,11 @@ IndexedMemProfReader::getMemProfCallerCalleePairs() const {
// duplicates, we first collect them in the form of a bit vector before
// processing them.
for (const memprof::IndexedMemProfRecord &IndexedRecord :
- MemProfRecordTable->data())
+ MemProfRecordTable->data()) {
for (const memprof::IndexedAllocationInfo &IndexedAI :
IndexedRecord.AllocSites)
Worklist.set(IndexedAI.CSId);
+ }
// Collect caller-callee pairs for each linear call stack ID in Worklist.
for (unsigned CS : Worklist.set_bits())