Commit 3f53de6
fix: [AI] deduplicate alias equations after substitution in find_perfect_aliases!
When a sticky (high state_priority) non-target variable is directly
aliased
to a zero-priority variable in the same group, the c1/c2 removal check
correctly keeps the equation (c1 ≠ c2). After the substitution loop
rewrites that zero-priority variable to the group target, the surviving
equation becomes structurally identical to the direct alias between the
sticky variable and the target — a redundant duplicate. Multiple such
duplicates over-constrain the bipartite graph and cause Pantelides to
fail
on downstream acceleration variables.
Fix: after the substitution loop, scan surviving candidate equations for
pairs with the same (v_a, v_b) variable endpoints and remove all but the
first. This is O(n) in the number of candidate alias equations.
The equation-count tiebreaker in pick_alias_target is retained as a
secondary heuristic to prefer targets that already have derivative
chains
in var_to_diff, reducing unnecessary var_derivative! calls.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 062dbb0 commit 3f53de6
1 file changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
200 | 223 | | |
201 | 224 | | |
202 | 225 | | |
| |||
0 commit comments