diff options
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 2 | ||||
-rw-r--r-- | test/passes/optimize-instructions.txt | 13 | ||||
-rw-r--r-- | test/passes/optimize-instructions.wast | 16 |
3 files changed, 30 insertions, 1 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index c6006d712..de6f96ccc 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -453,7 +453,7 @@ struct OptimizeInstructions : public WalkerPass<PostWalker<OptimizeInstructions, if ((count > 0 && count < 32 - bits) || (constSignBit && count == 0)) { // mixed or [zero upper const bits with sign bit set]; the compared values can never be identical, so // force something definitely impossible even after zext - assert(bits < 31); + assert(bits < 32); c->value = Literal(int32_t(0x80000000)); // TODO: if no side effects, we can just replace it all with 1 or 0 } else { diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt index 8b42fd2ad..604c9c3ea 100644 --- a/test/passes/optimize-instructions.txt +++ b/test/passes/optimize-instructions.txt @@ -1993,4 +1993,17 @@ ) ) ) + (func $sign-ext-1-and-ne (type $2) (result i32) + (select + (i32.ne + (i32.and + (call $sign-ext-1-and-ne) + (i32.const 2147483647) + ) + (i32.const -2147483648) + ) + (i32.const 2) + (i32.const 1) + ) + ) ) diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index 6d1fd60ed..cf8275412 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -2417,4 +2417,20 @@ ) ) ) + (func $sign-ext-1-and-ne (result i32) + (select + (i32.ne + (i32.const 1333788672) + (i32.shr_s + (i32.shl + (call $sign-ext-1-and-ne) + (i32.const 1) + ) + (i32.const 1) + ) + ) + (i32.const 2) + (i32.const 1) + ) + ) ) |