← board

Inline expansion — remaining slices (branch-with-locals + non-leaf)

What shipped already (context — do not redo)

feature-inline-routines delivered, all at -O2, all gated OptLevel>=2, -O0/-O1 byte-identical, validated O0-vs-O2 across ~700 programs + 4 cross targets:

The retention/splice machinery (TryRetainInlineBody / TryRetainInlineStmtBody in parser.inc; IRInlineExpand / IRCloneInlineBody in ir.inc; the reserved AST region + placeholders) is the reusable base for everything below.

Slice 2c — if-then-else with locals / multiple statements per branch

2b is straight-line only (rejects any AN_IF in a multi-statement body). The common next shape is a body that branches AND uses locals, e.g.

function Clamp(v, lo, hi: Integer): Integer; inline;
begin
  Result := v;
  if Result < lo then Result := lo;
  if Result > hi then Result := hi;
end;

Blockers to solve:

Slice 4 — non-leaf inlining (under a depth budget)

Drop the leaf-only rule: inline bodies that themselves call. The ~97% of call sites 2b/2c can't reach. Needs (see the design notes in [[feature-inline-routines]] "slice 4" section):

Acceptance (per slice)

Log