summaryrefslogtreecommitdiff
path: root/src/passes/RemoveUnusedBrs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/RemoveUnusedBrs.cpp')
-rw-r--r--src/passes/RemoveUnusedBrs.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp
index 3c4723c7f..b867dc4c2 100644
--- a/src/passes/RemoveUnusedBrs.cpp
+++ b/src/passes/RemoveUnusedBrs.cpp
@@ -203,11 +203,14 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> {
if (skip > 0) {
flows.resize(size - skip);
}
- // drop a nop at the end of a block, which prevents a value flowing
- while (list.size() > 0 && list.back()->is<Nop>()) {
- list.resize(list.size() - 1);
- self->anotherCycle = true;
- }
+ }
+ // Drop a nop at the end of a block, which prevents a value flowing. Note
+ // that this is worth doing regardless of whether we have a name on this
+ // block or not (which the if right above us checks) - such a nop is
+ // always unneeded and can limit later optimizations.
+ while (list.size() > 0 && list.back()->is<Nop>()) {
+ list.resize(list.size() - 1);
+ self->anotherCycle = true;
}
// A value flowing is only valid if it is a value that the block actually
// flows out. If it is never reached, it does not flow out, and may be