Skip to content

fix: lane C train for #1423, #1434, #729, #735, #739 (PRs 1429, 1436, 1414, 1415, 1416) - #1429

Merged
godofecht merged 19 commits into
mainfrom
fix/1423-rt-collect-calls-type
Oct 7, 2026
Merged

godofecht merged 19 commits into
mainfrom
fix/1423-rt-collect-calls-type

Conversation

@godofecht

@godofecht godofecht commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Lane C train: five small compiler/src fixes landed together, with one rebase onto main and one bootstrap regeneration.

Closes #1423.
Closes #1434.

PR Issue Change
#1429 #1423 rt_collect_calls stops at AST_TYPE nodes. [T; N] keeps the tag AST_TYPE_FIXED_ARRAY in c, and the walk recursed into it as a node index until the stack overflowed.
#1436 #1434 A repeated let in one scope reports variable 'a' is already declared in this scope at the binding.
#1414 part of #729 Span loops keep their bounds checks when the body rebinds the span or the induction variable.
#1415 part of #735 The profiler constructor reads the clock only when profiling is on.
#1416 part of #739 #pragma omp simd and GCC ivdep only with a proof: lets plus one reduction whose accumulator nothing else reads, or one store or select into a noalias restrict dst read only at [v]. One predicate covers for loops and rotated whiles. The #731 noalias_vectorize golden still passes.

Each PR's source commits are cherry-picked unchanged onto main d16e05d. The PRs' own bootstrap commits are dropped; the bootstrap C is regenerated once, in the last commit. The MLIR corpus digest of test_typecheck_overload_integration (it compiles the compiler's own modules) is re-recorded for the combined source; only that line moves. #1414's new docs/language/spans.md example assigned to a span parameter, which does not typecheck, so doc_examples --check-ledger failed; it now rebinds a let mut local, and its emitted C still keeps the bounds check.

Proof

Gates (macOS arm64, on this head)

Selftest flowc: PASS; --regen fixed point at gen3; --verify PASS, and again after the rebase onto 524633d (no compiler/ change in between); self_host_full ALL PASS; roundtrip ALL PASS; tests/cgen 141/0 (incl. noalias_vectorize, for_simd_*, span_bounds_rebinding); test-lang 275/0; test-runtime 34/0; tests/tools PASS; parity_mlir PASS (2526 corpus programs, 0 fail); typecheck_rules 139/0; parity_typecheck, parity_lowering and fmt_check clean; compile_profile 7/0; rt_summary PASS; tests/cli 152/2.

Known local drift, also on main: tests/cli jit_hello and test_mlir; parity_mlir corpus digests for files main has not recorded.

Risk

Low to moderate. #1416 narrows when SIMD pragmas are emitted, so some loops lose omp simd/ivdep and keep the clang vectorize request. The others are local fixes.

For [T; N] the parser stores the tag AST_TYPE_FIXED_ARRAY (2) in the c
field of the AST_TYPE node. rt_collect_calls recursed into c as a node
index and walked back into earlier nodes until the stack overflowed, so
flowc crashed on a [T; N] local in a function followed by another one.
A type holds no calls; the walk now skips its fields and follows next.

tests/lang/test_fixed_array_before_fn.flow crashes main's flowc (exit
139) and passes with this change.
…ntegration (#1423)

That test compiles the compiler's own modules, rt_summary.flow among them,
so its MLIR now carries the AST_TYPE early return in rt_collect_calls.
Only that line moves. parity_mlir: PASS.
A second let of the same name in one block counted a type error and
printed nothing, so --strict failed with only tc_errs=1. The Stage-A
checker now prints FILE:LINE:COL: error: variable 'a' is already
declared in this scope, the wording the playground compiler uses.

typecheck_rules/duplicate_let fails with main's flowc and passes here.
#pragma omp simd and GCC ivdep tell the C compiler that iterations are
independent. An indexed store does not prove that on its own: dst may be
src + 1. flowc_cgen_loop_omp_safe now accepts a body of `let` statements
followed by one statement that is either a reduction whose accumulator no
`let` reads, or a store or select `if` into dst[v] where the noalias
analysis made dst restrict (#731) and every expression reads dst only as
dst[v]. A reduction whose other operand reads the accumulator
(acc = acc + acc * 2) is a recurrence and no longer counts. The rotated
while loops from #1363 use the same predicate for their ivdep, and
flowc_cgen_body_omp_safe_skip is removed. Other loops keep the clang
vectorize request.

Carried from the SIMD half of the original #1416 branch; its copy half
landed as #1417.
…ntegration for the lane C train

That test compiles the compiler's own modules, so its MLIR moves with the
typecheck, cgen and profile changes in this train. Only that line moves.
@godofecht
godofecht force-pushed the fix/1423-rt-collect-calls-type branch from e0a8b85 to ac4f726 Compare October 7, 2026 18:36
@godofecht godofecht changed the title fix: stop rt_collect_calls at type nodes (#1423) fix: lane C train for #1423, #1434, #729, #735, #739 (PRs 1429, 1436, 1414, 1415, 1416) Oct 7, 2026
@godofecht
godofecht enabled auto-merge October 7, 2026 18:36
A span parameter is immutable, so the example now rebinds a let mut
local. doc_examples --check-ledger failed on it. The emitted C for the
new example still keeps the span bounds check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant