Skip to content

FIR-G: apply dead-code elimination, constant folding, inlining and general pipeline fusion (candidates are only reported today) #686

Closed

Description

@godofecht

Scope

Port optimization transforms and fusion algorithms from src/flow/fir_opts.py and src/flow/pipeline_fusion.py to Flow.

Deliverables

  • Interprocedural dead code elimination and constant folding passes on FIR-G.
  • Function inline scoring heuristics and inliner transformation.
  • Loop and pipeline stage fusion for DSP chaining operations.

Activity

  1. added
    self-hosting
    P2-medium
    on Aug 21, 2026
  2. added a commit that references this issue on Sep 10, 2026
  3. godofecht commented on Sep 11, 2026

    @godofecht
    ContributorAuthor

    #877 is useful progress but does not appear to complete this issue's stated scope. The merged self-host change adds compiler/src/pipeline_fusion.flow, wired into Stage-A, and implements the narrow adjacent scale_f32/scale_f64 fusion shape. The issue still calls for FIR-G interprocedural DCE, constant folding, inline scoring/inlining, and general loop/pipeline fusion. Keep #686 open until those remaining transforms are actually ported and locally qualified. Exact next action: split the missing FIR-G passes into focused implementation slices or update this issue's scope if the intended target has narrowed; do not mark the whole optimisation-pass port complete based on the current single fusion transform.

  4. changed the title [-][Self-Hosting Phase 3] Port FIR-G Optimisation Passes and Pipeline Fusion[/-] [+]FIR-G: apply dead-code elimination, constant folding, inlining and general pipeline fusion (candidates are only reported today)[/+] on Sep 30, 2026
  5. godofecht commented on Sep 30, 2026

    @godofecht
    ContributorAuthor

    State on main (ee5048d):

    The port part is done. What is left is new optimisation work; retitled to say so.

  6. godofecht commented on Oct 1, 2026

    @godofecht
    ContributorAuthor

    Implemented and merged #1161. FIR-G now applies safe trivial inlining for pure single-block expression functions with parameter loads, rebuilding dense SSA metadata and call-graph edges. flow fir-g --apply inline is covered by text, JSON, and --apply all cases. Focused FIR validation is 71 passed, 0 failed. Remaining scope: multi-block/function inlining and general loop/pipeline fusion.

  7. godofecht commented on Oct 1, 2026

    @godofecht
    ContributorAuthor

    The inliner slice is merged in #1161. The remaining work is multi-block/function inlining and general loop/pipeline fusion. The current native AST fusion already handles the documented map, scale, and offset compositions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2-mediumcompilerself-hosting

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions