diff options
Diffstat (limited to 'src/tools/wasm-reduce.cpp')
-rw-r--r-- | src/tools/wasm-reduce.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index 3860630af..4bb4b6f9a 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -898,8 +898,14 @@ struct Reducer } // If we are left with a single function that is not exported or used in // a table, that is useful as then we can change the return type. + bool allTablesEmpty = std::all_of( + module->tables.begin(), module->tables.end(), [&](auto& table) { + return std::all_of(table->segments.begin(), + table->segments.end(), + [&](auto& segment) { return segment.data.empty(); }); + }); if (module->functions.size() == 1 && module->exports.empty() && - module->table.segments.empty()) { + allTablesEmpty) { auto* func = module->functions[0].get(); // We can't remove something that might have breaks to it. if (!func->imported() && !Properties::isNamedControlFlow(func->body)) { |