summaryrefslogtreecommitdiff
path: root/src/passes/OptimizeInstructions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/OptimizeInstructions.cpp')
-rw-r--r--src/passes/OptimizeInstructions.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp
index d77db8093..b0d12eb95 100644
--- a/src/passes/OptimizeInstructions.cpp
+++ b/src/passes/OptimizeInstructions.cpp
@@ -1275,7 +1275,6 @@ private:
if ((matches(curr, binary(Abstract::Eq, any(&left), ival(0))))) {
return builder.makeUnary(EqZInt64, left);
}
-
// Operations on one
// (signed)x % 1 ==> 0
if (matches(curr, binary(Abstract::RemS, pure(&left), ival(1)))) {
@@ -1298,7 +1297,9 @@ private:
return left;
}
// i64(bool(x)) == 1 ==> i32(bool(x))
- if (matches(curr, binary(EqInt64, any(&left), i64(1))) &&
+ // i64(bool(x)) != 0 ==> i32(bool(x))
+ if ((matches(curr, binary(EqInt64, any(&left), i64(1))) ||
+ matches(curr, binary(NeInt64, any(&left), i64(0)))) &&
Bits::getMaxBits(left, this) == 1) {
return builder.makeUnary(WrapInt64, left);
}