Skip to content

perf: emit proven restrict/noalias in C and MLIR backends (#731) - #1344

Merged
godofecht merged 5 commits into
mainfrom
cursor/noalias-restrict-731-b0a5
Oct 5, 2026
Merged

godofecht merged 5 commits into
mainfrom
cursor/noalias-restrict-731-b0a5

Conversation

@godofecht

@godofecht godofecht commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Linked issue: #731 (parent #727).

First useful slice of proven noalias/restrict emission. Where flowc can already certify that two buffers do not alias, the C backend now writes restrict and the MLIR backend writes {llvm.noalias} (plus // flowc.noalias on qualifying locals). The analysis is fail-closed: unknown provenance never certifies disjointness.

This is the smallest useful change: a shared certificate, backend emission, structural tests, and negative cases. It does not close the whole issue.

Rebased onto current main (c5332d79, phase timing #1343). Inventory conflicts kept both noalias and profile. Corpus retarget from parity_mlir.flow --record is preserved. Bootstrap C regenerated after the rebase.

Overlap check

  • I searched open pull requests and recent commits for overlapping work.
  • This does not duplicate another active implementation, or the relationship is explained below.

Overlap / dependency notes:

Evidence

Targeted proof after rebase onto #1343:

  • Host selftest: flowc: PASS (includes profile_ok=1, type_id_ok=1, rt_summary_ok=1).
  • Host emit: restrict on add_into / pa; none on alias_copy / q.
  • ./flow tool tests/cgen/run.flow noalias_restrict — PASS.
  • ./flow test-lang tests/lang/test_noalias_overlap_copy.flow — PASS.
  • ./flow tool tests/scripts/noalias_mlir.flow — PASS.
  • ./compiler/scripts/bootstrap_from_c.sh --regen → FIXED POINT at gen3 (2,700,733 bytes).
  • ./compiler/scripts/bootstrap_from_c.sh --verify → PASS.
  • Prior turn: parity_mlir.flow --record then parity_mlir: PASS (23/23 fixtures, 2505 corpus programs). That corpus commit is on this rebase (c45b7fe2).
  • This turn: tests/mlir_commands/run.flow --record for mlir_defer_addr only — added // flowc.noalias py after the proven-local py alloca. Check: mlir_commands: pass=1 fail=0 for --only mlir_defer_addr. Noalias/restrict emission unchanged.

Risk

Compatibility

  • No user-visible compatibility change.
  • Compatibility change is documented in docs/project/CHANGELOG.md.

Remaining gaps (not this slice)

Agent handoff

Agent/provider/session: Cursor Cloud Agent.

Any remaining blocker is recorded in GitHub rather than only in local/session state:

  • Rebased onto c5332d79. New head: 76a34cc0cafbbcb409598a96676645628964ddf6. Do not merge until review.
Open in Web Open in Cursor 

@godofecht
godofecht marked this pull request as ready for review October 4, 2026 20:20
@cursor
cursor Bot force-pushed the cursor/noalias-restrict-731-b0a5 branch 4 times, most recently from 67c4da8 to 0243d43 Compare October 4, 2026 23:09
cursoragent and others added 3 commits October 5, 2026 00:31
Add a fail-closed provenance certificate for local arrays and constant
slices, then mark only proven-disjoint internal pointer parameters and
unique local pointers with C restrict and MLIR {llvm.noalias}.

Co-authored-by: Abhishek Shivakumar <[email protected]>
cgen calls flowc_noalias_* but the module was missing from
frontend_modules, the self-emit plan, roundtrip compile_module, and
the g2 fixed-point list. Same inventory pattern as type_id / rt_summary.

Co-authored-by: Abhishek Shivakumar <[email protected]>
{llvm.noalias} and // flowc.noalias comments change normalized MLIR
digests. Refresh via parity_mlir.flow --record (also records newly
accepted programs from #1341/#1342 and the noalias fixtures).

Co-authored-by: Abhishek Shivakumar <[email protected]>
@cursor
cursor Bot force-pushed the cursor/noalias-restrict-731-b0a5 branch from 4df442b to c45b7fe Compare October 5, 2026 00:31
cursoragent and others added 2 commits October 5, 2026 00:39
Fixed-point C after rebasing onto phase timing (#1343 / c5332d7).
bootstrap_from_c.sh --regen (FIXED POINT at gen3) then --verify PASS.

Co-authored-by: Abhishek Shivakumar <[email protected]>
flowc now emits // flowc.noalias on proven-local MLIR allocas. Re-record
the mlir_commands expected text so the check matches without weakening
noalias/restrict emission.

Co-authored-by: Abhishek Shivakumar <[email protected]>
@godofecht
godofecht merged commit 9a27887 into main Oct 5, 2026
38 checks passed
@godofecht
godofecht deleted the cursor/noalias-restrict-731-b0a5 branch October 12, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants