diff options
Diffstat (limited to 'src/passes/CodeFolding.cpp')
-rw-r--r-- | src/passes/CodeFolding.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp index 42331b747..305eb1278 100644 --- a/src/passes/CodeFolding.cpp +++ b/src/passes/CodeFolding.cpp @@ -234,6 +234,13 @@ struct CodeFolding if (!curr->ifFalse) { return; } + if (curr->condition->type == Type::unreachable) { + // If the arms are foldable and concrete, we would be replacing an + // unreachable If with a concrete block, which may or may not be valid, + // depending on the context. Leave this for DCE rather than trying to + // handle that. + return; + } // If both are blocks, look for a tail we can merge. auto* left = curr->ifTrue->dynCast<Block>(); auto* right = curr->ifFalse->dynCast<Block>(); |