diff options
author | Alon Zakai <azakai@google.com> | 2020-11-12 06:46:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-12 06:46:22 -0800 |
commit | d41782f9cac8cb059ccc03f69e10d44849e3d10f (patch) | |
tree | 56fcb1ad85ccaae824aae777ea4318ba1449504f /test/passes/optimize-instructions_all-features.txt | |
parent | 24bd9b984fc71c38d3d24c5f03fa81a15d591322 (diff) | |
download | binaryen-d41782f9cac8cb059ccc03f69e10d44849e3d10f.tar.gz binaryen-d41782f9cac8cb059ccc03f69e10d44849e3d10f.tar.bz2 binaryen-d41782f9cac8cb059ccc03f69e10d44849e3d10f.zip |
OptimizeInstructions: Fix regression from #3303 / #3275 (#3338)
X - Y <= 0
=>
X <= Y
That is true mathematically, but not in the case of an overflow, e.g.
X=10, Y=0x8000000000000000. X - Y is a negative number, so
X - Y <= 0 is true. But it is not true that X <= Y (as Y is negative, but
X is not).
See discussion in #3303 (comment)
The actual regression was in #3275, but the fuzzer had an easier time
finding it due to #3303
Diffstat (limited to 'test/passes/optimize-instructions_all-features.txt')
-rw-r--r-- | test/passes/optimize-instructions_all-features.txt | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/test/passes/optimize-instructions_all-features.txt b/test/passes/optimize-instructions_all-features.txt index 88b053835..7d223020f 100644 --- a/test/passes/optimize-instructions_all-features.txt +++ b/test/passes/optimize-instructions_all-features.txt @@ -4784,14 +4784,20 @@ ) (drop (i32.gt_s - (local.get $x) - (local.get $y) + (i32.sub + (local.get $x) + (local.get $y) + ) + (i32.const 0) ) ) (drop (i32.ge_s - (local.get $x) - (local.get $y) + (i32.sub + (local.get $x) + (local.get $y) + ) + (i32.const 0) ) ) (drop @@ -4808,14 +4814,20 @@ ) (drop (i32.lt_s - (local.get $x) - (local.get $y) + (i32.sub + (local.get $x) + (local.get $y) + ) + (i32.const 0) ) ) (drop (i32.le_s - (local.get $x) - (local.get $y) + (i32.sub + (local.get $x) + (local.get $y) + ) + (i32.const 0) ) ) (drop |