From aa06410ccd112d6276e734f8413f2754d32a1f47 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 27 Oct 2016 11:28:35 -0700 Subject: recurse in optimizeBoolean (#809) --- src/passes/OptimizeInstructions.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 6454d3510..6ba34990f 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -371,7 +371,17 @@ private: } } } + } else if (auto* block = boolean->dynCast()) { + if (block->type == i32 && block->list.size() > 0) { + block->list.back() = optimizeBoolean(block->list.back()); + } + } else if (auto* iff = boolean->dynCast()) { + if (iff->type == i32) { + iff->ifTrue = optimizeBoolean(iff->ifTrue); + iff->ifFalse = optimizeBoolean(iff->ifFalse); + } } + // TODO: recurse into br values? return boolean; } -- cgit v1.2.3