summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-09-07 14:58:43 -0700
committerGitHub <noreply@github.com>2021-09-07 14:58:43 -0700
commit7a17e2dec31d512163e048d36d59fdb6e31314c6 (patch)
treee2166d8cd68eb9494f9fdbcfbb2556eea0dd86e3 /src
parentffdae24a98ecc3f559c3bb02dcdfd79764f971db (diff)
downloadbinaryen-7a17e2dec31d512163e048d36d59fdb6e31314c6.tar.gz
binaryen-7a17e2dec31d512163e048d36d59fdb6e31314c6.tar.bz2
binaryen-7a17e2dec31d512163e048d36d59fdb6e31314c6.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/passes/Inlining.cpp8
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;
}
}