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.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp
index 3b053a5ca..4478a7bdd 100644
--- a/src/passes/OptimizeInstructions.cpp
+++ b/src/passes/OptimizeInstructions.cpp
@@ -939,6 +939,7 @@ private:
// Optimize given that the expression is flowing into a boolean context
Expression* optimizeBoolean(Expression* boolean) {
+ // TODO use a general getFallthroughs
if (auto* unary = boolean->dynCast<Unary>()) {
if (unary && unary->op == EqZInt32) {
auto* unary2 = unary->value->dynCast<Unary>();
@@ -975,6 +976,9 @@ private:
iff->ifTrue = optimizeBoolean(iff->ifTrue);
iff->ifFalse = optimizeBoolean(iff->ifFalse);
}
+ } else if (auto* select = boolean->dynCast<Select>()) {
+ select->ifTrue = optimizeBoolean(select->ifTrue);
+ select->ifFalse = optimizeBoolean(select->ifFalse);
}
// TODO: recurse into br values?
return boolean;