diff options
author | Alon Zakai <azakai@google.com> | 2020-01-24 11:28:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-24 11:28:18 -0800 |
commit | 1a0530da9c0217e7118965aeb4ee1f59f68df73c (patch) | |
tree | a20d1d84a9fd0b5d12a7ae4de76a02559a1005dc /src/passes/PostEmscripten.cpp | |
parent | 1ca6394d34c827904e6ececb6463ef4899c95fe9 (diff) | |
download | binaryen-1a0530da9c0217e7118965aeb4ee1f59f68df73c.tar.gz binaryen-1a0530da9c0217e7118965aeb4ee1f59f68df73c.tar.bz2 binaryen-1a0530da9c0217e7118965aeb4ee1f59f68df73c.zip |
Handle indirect calls in CallGraphPropertyAnalysis (#2624)
We ignored them, which is a bad default, as typically they imply
we can call anything in the table (and the table might change).
Instead, notice indirect calls during traversal, and force the user
to decide whether to ignore them or not.
This was only an issue in PostEmscripten because the other
user, Asyncify, already had indirect call analysis because it
needed it for other things.
Fixes a bug uncovered by #2619 and fixes the current binaryen
roll.
Diffstat (limited to 'src/passes/PostEmscripten.cpp')
-rw-r--r-- | src/passes/PostEmscripten.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/passes/PostEmscripten.cpp b/src/passes/PostEmscripten.cpp index e6eeb8e2a..ccf985c50 100644 --- a/src/passes/PostEmscripten.cpp +++ b/src/passes/PostEmscripten.cpp @@ -154,9 +154,11 @@ struct PostEmscripten : public Pass { } }); + // Assume an indirect call might throw. analyzer.propagateBack([](const Info& info) { return info.canThrow; }, [](const Info& info) { return true; }, - [](Info& info) { info.canThrow = true; }); + [](Info& info) { info.canThrow = true; }, + analyzer.IndirectCallsHaveProperty); // Apply the information. struct OptimizeInvokes : public WalkerPass<PostWalker<OptimizeInvokes>> { |