Semantic Optimization Pipeline
10 sections
Overview
Make proven facts survive into optimization — including algebraic structure. Ori's compiler already proves rich semantic facts about types, ownership, purity, and structure through the trait system, AIMS lattice, ARC pipeline, and type checker.
Planned
10 sections
Hygiene & Targeted Fixes
Split bloated files so downstream sections have clean, right-sized modules to extend (BUG-04-029 shift overflow already fixed)
LLVM Metadata Infrastructure
Build the metadata emission layer so Sections 03-04 can attach TBAA, range, and alias metadata to LLVM instructions
Backend-Neutral AIMS Facts and LLVM Projection
Freeze neutral AIMS ownership, fresh-allocation, effect/access, and disjointness facts once, then project them faithfully in every executor
TBAA, Range, and Invariant Metadata
Emit TBAA on struct field accesses, !range on bounded returns, and !invariant.load on immutable borrowed params
Structural Derive Normalization
Mark derived methods as memory(read) and leave a clean handoff for ARC-level peepholes to Section 09
Runtime Identity Fixes
Fix runtime string and list concat to be true algebraic identities so identity elimination in Section 09 is sound
Algebra Law Schema
Add algebraic law declarations, identity-provider traits, and the exported law/provenance index that Section 09 consumes
Algebra Law Adoption
Install algebraic law declarations on stdlib operator traits and impls so the normalization pass has laws to consume
Algebraic Normalization Pass
Build a step-3b ARC IR normalization pass that rewrites expressions using exported algebraic law metadata
Advanced Rewrites & Verification
Add distributivity, multiplicative inverse, cross-block TRMC activation, and comprehensive verification of the full optimization pipeline