summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/tool-options.h10
-rw-r--r--src/tools/wasm-reduce.cpp9
2 files changed, 12 insertions, 7 deletions
diff --git a/src/tools/tool-options.h b/src/tools/tool-options.h
index dd585612f..02572d72e 100644
--- a/src/tools/tool-options.h
+++ b/src/tools/tool-options.h
@@ -92,12 +92,12 @@ struct ToolOptions : public Options {
void applyFeatures(Module& module) {
if (hasFeatureOptions) {
if (!detectFeatures && module.hasFeaturesSection) {
- FeatureSet optionsFeatures = FeatureSet::All;
+ FeatureSet optionsFeatures = FeatureSet::MVP;
optionsFeatures.enable(enabledFeatures);
optionsFeatures.disable(disabledFeatures);
- if (!(module.features <= optionsFeatures)) {
- Fatal() << "module uses features not explicitly specified, "
- << "use --detect-features to resolve";
+ if (module.features != optionsFeatures) {
+ Fatal() << "module features do not match specified features. "
+ << "Use --detect-features to resolve.";
}
}
module.features.enable(enabledFeatures);
@@ -108,7 +108,7 @@ struct ToolOptions : public Options {
private:
bool hasFeatureOptions = false;
bool detectFeatures = false;
- FeatureSet enabledFeatures = FeatureSet::All;
+ FeatureSet enabledFeatures = FeatureSet::MVP;
FeatureSet disabledFeatures = FeatureSet::MVP;
};
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp
index 1f58da0d5..e064abbcb 100644
--- a/src/tools/wasm-reduce.cpp
+++ b/src/tools/wasm-reduce.cpp
@@ -271,7 +271,9 @@ struct Reducer : public WalkerPass<PostWalker<Reducer, UnifiedExpressionVisitor<
// try both combining with a generic shrink (so minor pass overhead is compensated for), and without
for (auto pass : passes) {
std::string currCommand = Path::getBinaryenBinaryTool("wasm-opt") + " ";
- currCommand += working + " -o " + test + " " + pass;
+ // TODO(tlively): -all should be replaced with an option to use the
+ // existing feature set, once implemented.
+ currCommand += working + " -all -o " + test + " " + pass;
if (debugInfo) currCommand += " -g ";
if (verbose) std::cerr << "| trying pass command: " << currCommand << "\n";
if (!ProgramResult(currCommand).failed()) {
@@ -321,6 +323,7 @@ struct Reducer : public WalkerPass<PostWalker<Reducer, UnifiedExpressionVisitor<
Module wasm;
ModuleReader reader;
reader.read(working, *module);
+ wasm.features = FeatureSet::All;
builder = make_unique<Builder>(*module);
setModule(module.get());
}
@@ -999,7 +1002,9 @@ int main(int argc, const char* argv[]) {
std::cerr << "|checking that command has expected behavior on canonicalized (read-written) binary\n";
{
// read and write it
- auto cmd = Path::getBinaryenBinaryTool("wasm-opt") + " " + input + " -o " + test;
+ // TODO(tlively): -all should be replaced with an option to use the existing
+ // feature set, once implemented.
+ auto cmd = Path::getBinaryenBinaryTool("wasm-opt") + " " + input + " -all -o " + test;
if (!binary) cmd += " -S";
ProgramResult readWrite(cmd);
if (readWrite.failed()) {