c66a21aa
by Simon Peyton Jones at 2026-11-17T21:07:16+00:00
Redesign the noinline magic
The principal goal of this MR is to avoid `noinline` getting in the way
of strictness analysis and specialisation. It involves a bit of redesign.
Main idea:
* When simplifying `noinline (f e1 e2)`, switch off inlining when
simplifying `f`, but not when simplifying `e1` and `e2`.
* Mechanism: see `simplOutId`, the `noinlineIdKey` case
* If: we see `noinline (f e1) e2`, the simplifier moves the `e2` inside;
see the `splitContArgs` call. This is important so you can write
`noinline f e1 e2` and have it mean the same as `noinline (f e1 e2)`.
* Now `f` sees all its arguments, hence:
* Fixes #27724 (noinline inhibits specialisation)
* Fixes #23911 (noinline worsens demand signatures)
* Also fixes #27803 where we were not respecting `noinline` if the RHS
was trivial
See Note [noinlineId magic] for lots of specifics. It's surprisingly tricky!
For some reason a couple of perf tests allocate 1.2% less at compile time,n
namely T29872 and T8095. Geom mean decease of 0.1%
Metric Decrease:
T9872d