From d1b598c542d174bd9a55d0edcdfaf27948a140dd Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 17 Jul 2017 10:23:42 -0700 Subject: add missing finalizations in removeUnusedBrs, when we change an if side and its outer block, we need to finalize the if first and then the block containing it --- src/passes/RemoveUnusedBrs.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp index 3ab0371ed..9fed3e4a5 100644 --- a/src/passes/RemoveUnusedBrs.cpp +++ b/src/passes/RemoveUnusedBrs.cpp @@ -226,6 +226,8 @@ struct RemoveUnusedBrs : public WalkerPass> { // we need the ifTrue to break, so it cannot reach the code we want to move if (ExpressionAnalyzer::obviouslyDoesNotFlowOut(iff->ifTrue)) { iff->ifFalse = builder.stealSlice(block, i + 1, list.size()); + iff->finalize(); + block->finalize(); return true; } } else { @@ -262,9 +264,13 @@ struct RemoveUnusedBrs : public WalkerPass> { if (ExpressionAnalyzer::obviouslyDoesNotFlowOut(iff->ifTrue)) { iff->ifFalse = blockifyMerge(iff->ifFalse, builder.stealSlice(block, i + 1, list.size())); + iff->finalize(); + block->finalize(); return true; } else if (ExpressionAnalyzer::obviouslyDoesNotFlowOut(iff->ifFalse)) { iff->ifTrue = blockifyMerge(iff->ifTrue, builder.stealSlice(block, i + 1, list.size())); + iff->finalize(); + block->finalize(); return true; } } -- cgit v1.2.3