From 7a17e2dec31d512163e048d36d59fdb6e31314c6 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 7 Sep 2021 14:58:43 -0700 Subject: Inlining: Track names over multiple iterations, not pointers (#4127) It can be confusing during debugging to keep a map of pointers when we might have removed some of those functions from the module meanwhile (if you iterate over it in some additional debug logging). This change has no observable effect, however, as no bug could have actually occurred in practice given that nothing is done with the pointers in the actual code. --- src/passes/Inlining.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/passes/Inlining.cpp b/src/passes/Inlining.cpp index 7a66f32a4..11e9c5a2c 100644 --- a/src/passes/Inlining.cpp +++ b/src/passes/Inlining.cpp @@ -360,7 +360,11 @@ struct Inlining : public Pass { // call. This is typically recursion, which to some extent can help, but // then like loop unrolling it loses its benefit quickly, so set a limit // here. - std::unordered_map iterationsInlinedInto; + // + // (Track names here, and not Function pointers, as we can remove functions + // while inlining, and it may be confusing during debugging to have a + // pointer to something that was removed.) + std::unordered_map iterationsInlinedInto; const size_t MaxIterationsForFunc = 5; @@ -384,7 +388,7 @@ struct Inlining : public Pass { #endif for (auto* func : inlinedInto) { - if (++iterationsInlinedInto[func] >= MaxIterationsForFunc) { + if (++iterationsInlinedInto[func->name] >= MaxIterationsForFunc) { return; } } -- cgit v1.2.3