@@ -69,7 +69,6 @@ int main(int argc, const char* argv[]) {
6969 bool fuzzBinary = false ;
7070 std::string extraFuzzCommand;
7171 bool translateToFuzz = false ;
72- bool fuzzAtomics = true ;
7372 bool fuzzPasses = false ;
7473 std::string emitJSWrapper;
7574 std::string emitSpecWrapper;
@@ -106,9 +105,6 @@ int main(int argc, const char* argv[]) {
106105 .add (" --translate-to-fuzz" , " -ttf" , " Translate the input into a valid wasm module *somehow*, useful for fuzzing" ,
107106 Options::Arguments::Zero,
108107 [&](Options *o, const std::string& arguments) { translateToFuzz = true ; })
109- .add (" --no-fuzz-atomics" , " -nfa" , " Disable generation of atomic opcodes with translate-to-fuzz (on by default)" ,
110- Options::Arguments::Zero,
111- [&](Options *o, const std::string& arguments) { fuzzAtomics = false ; })
112108 .add (" --fuzz-passes" , " -fp" , " Pick a random set of passes to run, useful for fuzzing. this depends on translate-to-fuzz (it picks the passes from the input)" ,
113109 Options::Arguments::Zero,
114110 [&](Options *o, const std::string& arguments) { fuzzPasses = true ; })
@@ -134,11 +130,6 @@ int main(int argc, const char* argv[]) {
134130 options.parse (argc, argv);
135131
136132 Module wasm;
137- // It should be safe to just always enable atomics in wasm-opt, because we
138- // don't expect any passes to accidentally generate atomic ops
139- FeatureSet features = Feature::Atomics;
140- // Same for MutableGlobals
141- features |= Feature::MutableGlobals;
142133
143134 if (options.debug ) std::cerr << " reading...\n " ;
144135
@@ -160,7 +151,7 @@ int main(int argc, const char* argv[]) {
160151 }
161152
162153 if (options.passOptions .validate ) {
163- if (!WasmValidator ().validate (wasm, features )) {
154+ if (!WasmValidator ().validate (wasm, options. getFeatures () )) {
164155 WasmPrinter::printModule (&wasm);
165156 Fatal () << " error in validating input" ;
166157 }
@@ -171,9 +162,9 @@ int main(int argc, const char* argv[]) {
171162 if (fuzzPasses) {
172163 reader.pickPasses (options);
173164 }
174- reader.build (fuzzAtomics );
165+ reader.build (options. getFeatures () );
175166 if (options.passOptions .validate ) {
176- if (!WasmValidator ().validate (wasm, features )) {
167+ if (!WasmValidator ().validate (wasm, options. getFeatures () )) {
177168 WasmPrinter::printModule (&wasm);
178169 std::cerr << " translate-to-fuzz must always generate a valid module" ;
179170 abort ();
@@ -226,7 +217,7 @@ int main(int argc, const char* argv[]) {
226217 WasmBinaryBuilder parser (other, input, false );
227218 parser.read ();
228219 if (options.passOptions .validate ) {
229- bool valid = WasmValidator ().validate (other, features );
220+ bool valid = WasmValidator ().validate (other, options. getFeatures () );
230221 if (!valid) {
231222 WasmPrinter::printModule (&other);
232223 }
@@ -240,7 +231,7 @@ int main(int argc, const char* argv[]) {
240231 auto runPasses = [&]() {
241232 options.runPasses (*curr);
242233 if (options.passOptions .validate ) {
243- bool valid = WasmValidator ().validate (*curr, features );
234+ bool valid = WasmValidator ().validate (*curr, options. getFeatures () );
244235 if (!valid) {
245236 WasmPrinter::printModule (&*curr);
246237 }
0 commit comments