summaryrefslogtreecommitdiff
path: root/src/passes/SimplifyLocals.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/SimplifyLocals.cpp')
-rw-r--r--src/passes/SimplifyLocals.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp
index 785bccf06..fbd1e7e57 100644
--- a/src/passes/SimplifyLocals.cpp
+++ b/src/passes/SimplifyLocals.cpp
@@ -126,6 +126,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals,
for (auto target : sw->targets) {
self->unoptimizableBlocks.insert(target);
}
+ self->unoptimizableBlocks.insert(sw->default_);
// TODO: we could use this info to stop gathering data on these blocks
}
self->sinkables.clear();
@@ -161,12 +162,16 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals,
// post-block cleanups
if (curr->name.is()) {
- unoptimizableBlocks.erase(curr->name);
- }
- if (hasBreaks) {
- // more than one path to here, so nonlinear
- sinkables.clear();
- blockBreaks.erase(curr->name);
+ if (unoptimizableBlocks.count(curr->name)) {
+ sinkables.clear();
+ unoptimizableBlocks.erase(curr->name);
+ }
+
+ if (hasBreaks) {
+ // more than one path to here, so nonlinear
+ sinkables.clear();
+ blockBreaks.erase(curr->name);
+ }
}
}