Files
f52bbc370f Fold constant-mask phis out of branch conditions (#59)
A BlockIf whose condition is a diamond-produced constant mask —
phi(c ? K : 0), K != 0 — now branches on the diamond's own condition c.
The mask is truthy exactly when c is (c dominates the consumer through
the head and the join), so the rewrite is exact; the mask value stays
for its other uses and dies in DCE when the branch was the last one.

Besides being a real simplification, this unblocks a shape the Go arm64
backend cannot assemble: an if materializing -1/0 whose result feeds
another conditional makes gc emit CSEL with an always-true condition,
which the assembler rejects ("illegal combination: CSEL PLDL1KEEP...",
reproducible with 14 lines of ordinary Go on both go1.25 and go1.26).
perl 5.44's charclass code produces exactly that shape, so its
transpiled bundle failed to build for GOARCH=arm64 at all — with this
fold it builds on both arm64 and amd64.

Co-authored-by: Claude Fable 5 <[email protected]>
2026-08-31 13:10:09 +09:00
..