Skip to content

Commit 04379ba

Browse files
Address comments.
1 parent a28f3cc commit 04379ba

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ namespace memprof {
6666

6767
// Extract all calls from the IR. Arrange them in a map from caller GUIDs to a
6868
// list of call sites, each of the form {LineLocation, CalleeGUID}.
69-
DenseMap<uint64_t, SmallVector<CallEdgeTy, 0>>
70-
extractCallsFromIR(Module &M, const TargetLibraryInfo &TLI,
71-
function_ref<bool(uint64_t)> IsPresentInProfile);
69+
DenseMap<uint64_t, SmallVector<CallEdgeTy, 0>> extractCallsFromIR(
70+
Module &M, const TargetLibraryInfo &TLI,
71+
function_ref<bool(uint64_t)> IsPresentInProfile = [](uint64_t) {
72+
return true;
73+
});
7274

7375
struct LineLocationHash {
7476
uint64_t operator()(const LineLocation &Loc) const {

llvm/test/Transforms/PGOProfile/memprof_undrift_missing_leaf.ll

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
;; This test case is taken from memprof_missing_leaf.ll with the profile
33
;; drifted.
44

5-
;; Avoid failures on big-endian systems that can't read the profile properly
6-
; REQUIRES: x86_64-linux
7-
85
; RUN: split-file %s %t
96
; RUN: llvm-profdata merge %t/memprof_missing_leaf.yaml -o %t/memprof_missing_leaf.memprofdata
107
; RUN: opt < %t/memprof_missing_leaf.ll -passes='memprof-use<profile-filename=%t/memprof_missing_leaf.memprofdata>' -memprof-salvage-stale-profile -S | FileCheck %s
@@ -19,8 +16,6 @@ HeapProfileRecords:
1916
MemInfoBlock:
2017
AllocCount: 1
2118
TotalSize: 1
22-
TotalLifetime: 0
23-
TotalLifetimeAccessDensity: 0
2419
CallSites: []
2520
...
2621
;--- memprof_missing_leaf.ll

llvm/unittests/Transforms/Instrumentation/MemProfUseTest.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ declare !dbg !19 void @_Z2f3v()
9292

9393
TargetLibraryInfoWrapperPass WrapperPass;
9494
auto &TLI = WrapperPass.getTLI(*F);
95-
auto IsPresentInProfile = [](uint64_t) { return true; };
96-
auto Calls = extractCallsFromIR(*M, TLI, IsPresentInProfile);
95+
auto Calls = extractCallsFromIR(*M, TLI);
9796

9897
// Expect exactly one caller.
9998
ASSERT_THAT(Calls, SizeIs(1));
@@ -194,8 +193,7 @@ declare !dbg !25 void @_Z2g2v() local_unnamed_addr
194193

195194
TargetLibraryInfoWrapperPass WrapperPass;
196195
auto &TLI = WrapperPass.getTLI(*F);
197-
auto IsPresentInProfile = [](uint64_t) { return true; };
198-
auto Calls = extractCallsFromIR(*M, TLI, IsPresentInProfile);
196+
auto Calls = extractCallsFromIR(*M, TLI);
199197

200198
// Expect exactly 4 callers.
201199
ASSERT_THAT(Calls, SizeIs(4));
@@ -290,8 +288,7 @@ attributes #2 = { builtin allocsize(0) }
290288

291289
TargetLibraryInfoWrapperPass WrapperPass;
292290
auto &TLI = WrapperPass.getTLI(*F);
293-
auto IsPresentInProfile = [](uint64_t) { return true; };
294-
auto Calls = extractCallsFromIR(*M, TLI, IsPresentInProfile);
291+
auto Calls = extractCallsFromIR(*M, TLI);
295292

296293
// Expect exactly one caller.
297294
ASSERT_THAT(Calls, SizeIs(1));
@@ -407,8 +404,7 @@ attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "t
407404

408405
TargetLibraryInfoWrapperPass WrapperPass;
409406
auto &TLI = WrapperPass.getTLI(*F);
410-
auto IsPresentInProfile = [](uint64_t) { return true; };
411-
auto Calls = extractCallsFromIR(*M, TLI, IsPresentInProfile);
407+
auto Calls = extractCallsFromIR(*M, TLI);
412408

413409
uint64_t GUIDFoo = IndexedMemProfRecord::getGUID("_Z3foov");
414410
uint64_t GUIDBar = IndexedMemProfRecord::getGUID("_Z3barv");

0 commit comments

Comments
 (0)