[llvm] [memprof] Initialize AllocInfoIter and CallSitesIter (NFC) (PR #124972)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 11:01:30 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/124972
This patch initializes AllocInfoIter and CallSitesIter to their
respective end(). I'm doing this not because I'm worried about
uninitialized iterators, but because the resulting code looks shorter
and makes it clear which data structure each iterator is associated
with.
>From a808a9ca39dd7543263f34332a3b173f8f54a851 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 29 Jan 2025 10:39:18 -0800
Subject: [PATCH] [memprof] Initialize AllocInfoIter and CallSitesIter (NFC)
This patch initializes AllocInfoIter and CallSitesIter to their
respective end(). I'm doing this not because I'm worried about
uninitialized iterators, but because the resulting code looks shorter
and makes it clear which data structure each iterator is associated
with.
---
llvm/lib/Transforms/Instrumentation/MemProfiler.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index 9a7eec76cc1d1d1..91c48338d032089 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -1096,9 +1096,8 @@ readMemprof(Module &M, Function &F, IndexedInstrProfReader *MemProfReader,
// can happen because we don't currently have discriminators to
// distinguish the case when a single line/col maps to both an allocation
// and another callsite).
- std::map<uint64_t, std::set<const AllocationInfo *>>::iterator
- AllocInfoIter;
- decltype(LocHashToCallSites)::iterator CallSitesIter;
+ auto AllocInfoIter = LocHashToAllocInfo.end();
+ auto CallSitesIter = LocHashToCallSites.end();
for (const DILocation *DIL = I.getDebugLoc(); DIL != nullptr;
DIL = DIL->getInlinedAt()) {
// Use C++ linkage name if possible. Need to compile with
More information about the llvm-commits
mailing list