summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tools/execution-results.h17
-rw-r--r--src/tools/wasm-opt.cpp2
-rw-r--r--test/lit/exec/trap.wast55
3 files changed, 3 insertions, 71 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h
index 10e243287..2491fbf1b 100644
--- a/src/tools/execution-results.h
+++ b/src/tools/execution-results.h
@@ -95,12 +95,6 @@ struct ExecutionResults {
// If set, we should ignore this and not compare it to anything.
bool ignore = false;
- // If set, we don't compare whether a trap has occurred or not.
- bool ignoreTrap = false;
-
- ExecutionResults(const PassOptions& options)
- : ignoreTrap(options.ignoreImplicitTraps || options.trapsNeverHappen) {}
- ExecutionResults(bool ignoreTrap) : ignoreTrap(ignoreTrap) {}
// get results of execution
void get(Module& wasm) {
@@ -140,7 +134,7 @@ struct ExecutionResults {
// get current results and check them against previous ones
void check(Module& wasm) {
- ExecutionResults optimizedResults(ignoreTrap);
+ ExecutionResults optimizedResults;
optimizedResults.get(wasm);
if (optimizedResults != *this) {
std::cout << "[fuzz-exec] optimization passes changed results\n";
@@ -202,14 +196,7 @@ struct ExecutionResults {
}
std::cout << "[fuzz-exec] comparing " << name << '\n';
if (results[name].index() != other.results[name].index()) {
- if (ignoreTrap) {
- if (!std::get_if<Trap>(&results[name]) &&
- !std::get_if<Trap>(&other.results[name])) {
- return false;
- }
- } else {
- return false;
- }
+ return false;
}
auto* values = std::get_if<Literals>(&results[name]);
auto* otherValues = std::get_if<Literals>(&other.results[name]);
diff --git a/src/tools/wasm-opt.cpp b/src/tools/wasm-opt.cpp
index 3927e513c..538496ecf 100644
--- a/src/tools/wasm-opt.cpp
+++ b/src/tools/wasm-opt.cpp
@@ -314,7 +314,7 @@ int main(int argc, const char* argv[]) {
runner.run();
}
- ExecutionResults results(options.passOptions);
+ ExecutionResults results;
if (fuzzExecBefore) {
results.get(wasm);
}
diff --git a/test/lit/exec/trap.wast b/test/lit/exec/trap.wast
deleted file mode 100644
index a0ed6f0f2..000000000
--- a/test/lit/exec/trap.wast
+++ /dev/null
@@ -1,55 +0,0 @@
-;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited.
-
-;; RUN: wasm-opt %s --vacuum --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s
-;; RUN: wasm-opt %s --ignore-implicit-traps --vacuum --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s --check-prefix=IIT
-;; RUN: wasm-opt %s --traps-never-happen --vacuum --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s --check-prefix=TNH
-
-(module
- ;; CHECK: [fuzz-exec] calling trap
- ;; CHECK-NEXT: [trap unreachable]
- ;; IIT: [fuzz-exec] calling trap
- ;; IIT-NEXT: [trap unreachable]
- ;; TNH: [fuzz-exec] calling trap
- ;; TNH-NEXT: [trap unreachable]
- (func "trap"
- (unreachable)
- )
-
- (memory 1 1)
- ;; CHECK: [fuzz-exec] calling load-trap
- ;; CHECK-NEXT: [trap highest > memory: 65536 > 65532]
- ;; IIT: [fuzz-exec] calling load-trap
- ;; IIT-NEXT: [trap highest > memory: 65536 > 65532]
- ;; TNH: [fuzz-exec] calling load-trap
- ;; TNH-NEXT: [trap highest > memory: 65536 > 65532]
- (func "load-trap"
- ;; This load traps, so this cannot be removed. But if either of
- ;; --ignore-implicit-traps or --traps-never-happen is set, this load is
- ;; assumed not to trap and we end up optimizing this out with --vacuum,
- ;; causes the trap behavior to change. This should not result in [fuzz-exec]
- ;; comparison failure.
- (drop
- (i32.load (i32.const 65536))
- )
- )
-)
-;; CHECK: [fuzz-exec] calling trap
-;; CHECK-NEXT: [trap unreachable]
-
-;; CHECK: [fuzz-exec] calling load-trap
-;; CHECK-NEXT: [trap highest > memory: 65536 > 65532]
-;; CHECK-NEXT: [fuzz-exec] comparing load-trap
-;; CHECK-NEXT: [fuzz-exec] comparing trap
-
-;; IIT: [fuzz-exec] calling trap
-;; IIT-NEXT: [trap unreachable]
-
-;; IIT: [fuzz-exec] calling load-trap
-;; IIT-NEXT: [fuzz-exec] comparing load-trap
-;; IIT-NEXT: [fuzz-exec] comparing trap
-
-;; TNH: [fuzz-exec] calling trap
-
-;; TNH: [fuzz-exec] calling load-trap
-;; TNH-NEXT: [fuzz-exec] comparing load-trap
-;; TNH-NEXT: [fuzz-exec] comparing trap