diff options
author | Alon Zakai <azakai@google.com> | 2021-07-22 10:23:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-22 10:23:15 -0700 |
commit | b9b8d74a4c646c4df7ddad5be195cff976cf6704 (patch) | |
tree | b0abe220fed2a993feaf29bf8f9933ded7862f95 /src/passes/OptimizeInstructions.cpp | |
parent | 556381b41aa95b56a77e9217afb2e2d7ecb230f5 (diff) | |
download | binaryen-b9b8d74a4c646c4df7ddad5be195cff976cf6704.tar.gz binaryen-b9b8d74a4c646c4df7ddad5be195cff976cf6704.tar.bz2 binaryen-b9b8d74a4c646c4df7ddad5be195cff976cf6704.zip |
Do not create a select with multivalue arms in OptimizeInstructions (#4012)
Similar to #4005 but on OptimizeInstructions instead of RemoveUnusedBrs.
Diffstat (limited to 'src/passes/OptimizeInstructions.cpp')
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 9f095b333..31ed9348a 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -3037,7 +3037,12 @@ private: curr->ifTrue) .hasSideEffects(); - if (validTypes && validEffects) { + // In addition, check for specific limitations of select. + bool validChildren = + !std::is_same<T, Select>::value || + Properties::canEmitSelectWithArms(ifTrueChild, ifFalseChild); + + if (validTypes && validEffects && validChildren) { // Replace ifTrue with its child. curr->ifTrue = ifTrueChild; // Relace ifFalse with its child, and reuse that node outside. |