Commit 61c319c
committed
Fix Branch/CondBranch Edge bug: use C++ bridge for in_edges management
Pure C factories wrote edge.to directly, bypassing Edge::set_to() which
manages BasicBlock::in_edges_ (predecessor tracking). This causes null
in_edge entries → DominatorAnalysis crash at analysis.cpp:524.
Root cause: Edge::set_to() updates target block's in_edges_ set (C++
std::unordered_set), which cannot be done from pure C. Branch and
CondBranch factories must use C++ bridge to call Edge constructor.
Fix: add hir_c_create_branch_cpp and hir_c_create_cond_branch_cpp
in hir_c_api.cpp that use Branch::create/CondBranch::create (proper
Edge initialization via CondBranchBase constructor → set_true_bb →
Edge::set_to → in_edges_.insert).1 parent bb3b2df commit 61c319c
3 files changed
Lines changed: 33 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
588 | 603 | | |
589 | 604 | | |
590 | 605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
161 | 171 | | |
162 | 172 | | |
163 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
180 | 182 | | |
181 | | - | |
| 183 | + | |
182 | 184 | | |
183 | 185 | | |
184 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
185 | 189 | | |
186 | 190 | | |
187 | | - | |
| 191 | + | |
188 | 192 | | |
189 | 193 | | |
190 | 194 | | |
| |||
0 commit comments