summaryrefslogtreecommitdiff
path: root/src/mir/from_hir_match.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir/from_hir_match.cpp')
-rw-r--r--src/mir/from_hir_match.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mir/from_hir_match.cpp b/src/mir/from_hir_match.cpp
index d9c33d5f..c7c0ad8f 100644
--- a/src/mir/from_hir_match.cpp
+++ b/src/mir/from_hir_match.cpp
@@ -1601,6 +1601,14 @@ void DecisionTreeNode::simplify()
TU_MATCHA( (m_branches), (e),
(Unset,
+ H::simplify_branch(m_default);
+ // Replace `this` with `m_default` if `m_default` is a subtree
+ // - Fixes the edge case for the top of the tree
+ if( m_default.is_Subtree() )
+ {
+ *this = mv$(*m_default.as_Subtree());
+ }
+ return ;
),
(Bool,
H::simplify_branch(e.false_branch);