Skip to content

Commit 26ff649

Browse files
Address comments.
1 parent ed3c386 commit 26ff649

File tree

3 files changed

+12
-21
lines changed

3 files changed

+12
-21
lines changed

llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ namespace memprof {
6262
struct LineLocation {
6363
LineLocation(uint32_t L, uint32_t D) : LineOffset(L), Column(D) {}
6464

65-
void print(raw_ostream &OS) const;
66-
void dump() const;
67-
6865
bool operator<(const LineLocation &O) const {
6966
return LineOffset < O.LineOffset ||
7067
(LineOffset == O.LineOffset && Column < O.Column);

llvm/lib/Transforms/Instrumentation/MemProfiler.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,10 +833,9 @@ memprof::extractCallsFromIR(Module &M) {
833833
}
834834

835835
// Sort each call list by the source location.
836-
for (auto &KV : Calls) {
837-
auto &Calls = KV.second;
838-
llvm::sort(Calls);
839-
Calls.erase(llvm::unique(Calls), Calls.end());
836+
for (auto &[CallerGUID, CallList] : Calls) {
837+
llvm::sort(CallList);
838+
CallList.erase(llvm::unique(CallList), CallList.end());
840839
}
841840

842841
return Calls;

llvm/unittests/Transforms/Instrumentation/MemProfUseTest.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,14 @@ declare !dbg !19 void @_Z2f3v()
9090

9191
// Verify that call sites show up in the ascending order of their source
9292
// locations.
93-
EXPECT_EQ(CallSites[0].first.LineOffset, 1U);
94-
EXPECT_EQ(CallSites[0].first.Column, 3U);
95-
EXPECT_EQ(CallSites[0].second,
96-
memprof::IndexedMemProfRecord::getGUID("_Z2f1v"));
97-
98-
EXPECT_EQ(CallSites[1].first.LineOffset, 2U);
99-
EXPECT_EQ(CallSites[1].first.Column, 3U);
100-
EXPECT_EQ(CallSites[1].second,
101-
memprof::IndexedMemProfRecord::getGUID("_Z2f2v"));
102-
103-
EXPECT_EQ(CallSites[2].first.LineOffset, 2U);
104-
EXPECT_EQ(CallSites[2].first.Column, 9U);
105-
EXPECT_EQ(CallSites[2].second,
106-
memprof::IndexedMemProfRecord::getGUID("_Z2f3v"));
93+
EXPECT_THAT(CallSites[0],
94+
testing::Pair(testing::FieldsAre(1U, 3U),
95+
memprof::IndexedMemProfRecord::getGUID("_Z2f1v")));
96+
EXPECT_THAT(CallSites[1],
97+
testing::Pair(testing::FieldsAre(2U, 3U),
98+
memprof::IndexedMemProfRecord::getGUID("_Z2f2v")));
99+
EXPECT_THAT(CallSites[2],
100+
testing::Pair(testing::FieldsAre(2U, 9U),
101+
memprof::IndexedMemProfRecord::getGUID("_Z2f3v")));
107102
}
108103
} // namespace

0 commit comments

Comments
 (0)