diff options
-rw-r--r-- | src/passes/Inlining.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
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<Function*, Index> 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<Name, Index> 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; } } |