Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
a7f15858
by sheaf at 2025-09-24T09:49:53-04:00
1 changed file:
Changes:
| ... | ... | @@ -486,17 +486,18 @@ behaviour: |
| 486 | 486 | optimisation level etc.
|
| 487 | 487 | |
| 488 | 488 | - Like ``INLINE``, the ``INLINABLE`` pragma retains a copy of the
|
| 489 | - original RHS for inlining purposes, and persists it in the interface
|
|
| 489 | + RHS for inlining purposes, and persists it in the interface
|
|
| 490 | 490 | file, regardless of the size of the RHS.
|
| 491 | + The RHS will be carefully optimised so that, when the function
|
|
| 492 | + inlines, GHC behaves as if the original RHS had been inlined.
|
|
| 491 | 493 | |
| 492 | 494 | - One way to use ``INLINABLE`` is in conjunction with the special
|
| 493 | 495 | function ``inline`` (:ref:`special-ids`). The call ``inline f`` tries
|
| 494 | 496 | very hard to inline ``f``. To make sure that ``f`` can be inlined, it
|
| 495 | 497 | is a good idea to mark the definition of ``f`` as ``INLINABLE``, so
|
| 496 | 498 | that GHC guarantees to expose an unfolding regardless of how big it
|
| 497 | - is. Moreover, by annotating ``f`` as ``INLINABLE``, you ensure that
|
|
| 498 | - ``f``\'s original RHS is inlined, rather than whatever random
|
|
| 499 | - optimised version of ``f`` GHC's optimiser has produced.
|
|
| 499 | + is. You can also provide an explicit :ref:`phase-control` on the
|
|
| 500 | + ``INLINABLE`` pragma to ensure that RULES have a chance of firing first.
|
|
| 500 | 501 | |
| 501 | 502 | - The ``INLINABLE`` pragma also works with ``SPECIALISE``: if you mark
|
| 502 | 503 | function ``f`` as ``INLINABLE``, then you can subsequently
|