A string `==`/`!=` used as an operand of a short-circuit `and`/`or` emitted invalid LLVM (`PHI node entries do not match predecessors!`). String compares expand into their own memcmp sub-CFG during LLVM emission, so the operand finishes in a later basic block (`str.merge`) than the one the IR block started in. `fixupPhiNodes` wired the short-circuit merge PHI's incoming edge to `block_map[ir_block]` (the block the IR block started as), recording a stale predecessor (`%entry`/`%and.rhs.0`). Fix: record the builder's actual insertion block after emitting each IR block's instructions (`term_block_map`, via `LLVMGetInsertBlock`) and use it as the PHI predecessor. General — corrects the incoming block for any operand that emitted intermediate basic blocks (string `==`, value `match`, …), not just string `==`. Regression: examples/0045-basic-string-eq-short-circuit.sx (string `==` on both sides of `and` and of `or`, plus a match-value + enum-payload `==` shape). Fails (LLVM abort) pre-fix, passes after.
2 B
2 B