diff options
Diffstat (limited to 'src/passes/Vacuum.cpp')
-rw-r--r-- | src/passes/Vacuum.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/passes/Vacuum.cpp b/src/passes/Vacuum.cpp index 40f4a6e59..3f27fb36a 100644 --- a/src/passes/Vacuum.cpp +++ b/src/passes/Vacuum.cpp @@ -232,6 +232,16 @@ struct Vacuum : public WalkerPass<PostWalker<Vacuum>> { replaceCurrent(child); return; } + // if the condition is unreachable, just return it + if (curr->condition->type == unreachable) { + typeUpdater.noteRecursiveRemoval(curr->ifTrue); + if (curr->ifFalse) { + typeUpdater.noteRecursiveRemoval(curr->ifFalse); + } + replaceCurrent(curr->condition); + return; + } + // from here on, we can assume the condition executed if (curr->ifFalse) { if (curr->ifFalse->is<Nop>()) { curr->ifFalse = nullptr; |