diff options
author | Max Graey <maxgraey@gmail.com> | 2022-09-21 19:24:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 16:24:56 +0000 |
commit | 8f385b04afd6e968fa83dfade7f7858ba0824e37 (patch) | |
tree | 1ed199b68071e7f49c9f72df4b8fb046e8650b99 /src/passes/OptimizeInstructions.cpp | |
parent | 7fb6cfb4e0ef3af329cb6481407f9b167b4ac491 (diff) | |
download | binaryen-8f385b04afd6e968fa83dfade7f7858ba0824e37.tar.gz binaryen-8f385b04afd6e968fa83dfade7f7858ba0824e37.tar.bz2 binaryen-8f385b04afd6e968fa83dfade7f7858ba0824e37.zip |
[OptimizeInstruction] Prevent reordering for rule in #5034 (#5066)
Diffstat (limited to 'src/passes/OptimizeInstructions.cpp')
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 2f1b6b6a4..e9cf3baaa 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -416,8 +416,9 @@ struct OptimizeInstructions { // -x + y ==> y - x // where x, y are floating points - Expression* x; - if (matches(curr, binary(Add, unary(Neg, any(&x)), any()))) { + Expression *x, *y; + if (matches(curr, binary(Add, unary(Neg, any(&x)), any(&y))) && + canReorder(x, y)) { curr->op = Abstract::getBinary(curr->type, Sub); curr->left = x; std::swap(curr->left, curr->right); |