[llvm] [memprof] Initialize AllocInfoIter and CallSitesIter (NFC) (PR #124972)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 11:02:04 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/124972.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Instrumentation/MemProfiler.cpp (+2-3)
``````````diff
diff --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index 9a7eec76cc1d1d..91c48338d03208 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
``````````
</details>
https://github.com/llvm/llvm-project/pull/124972
More information about the llvm-commits
mailing list