diff options
Diffstat (limited to 'src/passes/SimplifyLocals.cpp')
-rw-r--r-- | src/passes/SimplifyLocals.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp index 23ab1bc92..2f269a00d 100644 --- a/src/passes/SimplifyLocals.cpp +++ b/src/passes/SimplifyLocals.cpp @@ -126,8 +126,7 @@ struct SimplifyLocals Expression** currp) { // Main processing. auto* curr = *currp; - if (curr->is<Break>()) { - auto* br = curr->cast<Break>(); + if (auto* br = curr->dynCast<Break>()) { if (br->value) { // value means the block already has a return value self->unoptimizableBlocks.insert(br->name); @@ -147,6 +146,10 @@ struct SimplifyLocals self->unoptimizableBlocks.insert(target); } // TODO: we could use this info to stop gathering data on these blocks + } else if (auto* br = curr->dynCast<BrOnExn>()) { + // We cannot optimize the block this targets to have a return value, as + // the br_on_exn doesn't support a change to the block's type + self->unoptimizableBlocks.insert(br->name); } self->sinkables.clear(); } @@ -162,10 +165,9 @@ struct SimplifyLocals static void doNoteIfTrue(SimplifyLocals<allowTee, allowStructure, allowNesting>* self, Expression** currp) { - auto* iff = (*currp)->dynCast<If>(); + auto* iff = (*currp)->cast<If>(); if (iff->ifFalse) { // We processed the ifTrue side of this if-else, save it on the stack. - assert((*currp)->cast<If>()->ifFalse); self->ifStack.push_back(std::move(self->sinkables)); } else { // This is an if without an else. |