We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd0a99e commit e6fcb78Copy full SHA for e6fcb78
src/passes/TailCall.cpp
@@ -8,7 +8,7 @@ namespace wasm {
8
9
namespace {
10
11
-struct Finder : PostWalker<Finder> {
+struct Finder : TryDepthWalker<Finder> {
12
std::vector<Call*> tailCalls;
13
std::vector<CallIndirect*> tailCallIndirects;
14
void visitFunction(Function* curr) { checkTailCall(curr->body); }
@@ -19,6 +19,10 @@ struct Finder : PostWalker<Finder> {
19
if (expr == nullptr) {
20
return;
21
}
22
+ if (tryDepth > 0) {
23
+ // We are in a try block, so we cannot optimize tail calls.
24
+ return;
25
+ }
26
if (auto* call = expr->dynCast<Call>()) {
27
if (!call->isReturn && call->type == getFunction()->getResults()) {
28
tailCalls.push_back(call);
0 commit comments