diff options
author | Max Graey <maxgraey@gmail.com> | 2021-09-20 23:05:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-20 13:05:15 -0700 |
commit | 0e143ffb60b43eade8a7315e62c1f482536e3d1b (patch) | |
tree | 6cea898b57b59154f3108182ed836d33811848b2 /src/passes/OptimizeInstructions.cpp | |
parent | c95f5ade0b50b8373497297bbfbe606f685d8bc9 (diff) | |
download | binaryen-0e143ffb60b43eade8a7315e62c1f482536e3d1b.tar.gz binaryen-0e143ffb60b43eade8a7315e62c1f482536e3d1b.tar.bz2 binaryen-0e143ffb60b43eade8a7315e62c1f482536e3d1b.zip |
[Matcher] Add bval for matching boolean literals (#4162)
Diffstat (limited to 'src/passes/OptimizeInstructions.cpp')
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index cc263d228..d18990e8e 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -3350,14 +3350,9 @@ private: curr->ifTrue->type != Type::unreachable && curr->ifFalse->type != Type::unreachable) { Unary* un; - Expression* x; Const* c; auto check = [&](Expression* a, Expression* b) { - if (matches(a, unary(&un, EqZ, any(&x))) && matches(b, ival(&c))) { - auto value = c->value.getInteger(); - return value == 0 || value == 1; - } - return false; + return matches(b, bval(&c)) && matches(a, unary(&un, EqZ, any())); }; if (check(curr->ifTrue, curr->ifFalse) || check(curr->ifFalse, curr->ifTrue)) { |