Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
d3690ae8
by Andreas Klebinger at 2026-03-11T15:04:31-04:00
2 changed files:
Changes:
| ... | ... | @@ -570,6 +570,12 @@ optionally specify a phase number, thus: |
| 570 | 570 | - "``NOINLINE[~k] f``" means: be willing to inline ``f`` until phase
|
| 571 | 571 | ``k``, but from phase ``k`` onwards do not inline it.
|
| 572 | 572 | |
| 573 | +- "``INLINEABLE[k] f``" means: do not inline ``f`` until phase ``k``, but
|
|
| 574 | + from phase ``k`` onwards GHC is free to inline it.
|
|
| 575 | + |
|
| 576 | +- "``INLINEABLE[~k] f``" means: GHC is free to inline ``f`` until phase
|
|
| 577 | + ``k``, but from phase ``k`` onwards do not inline it.
|
|
| 578 | + |
|
| 573 | 579 | The same information is summarised here:
|
| 574 | 580 | |
| 575 | 581 | .. code-block:: none
|
| ... | ... | @@ -579,6 +585,8 @@ The same information is summarised here: |
| 579 | 585 | {-# INLINE [~2] f #-} -- Yes No
|
| 580 | 586 | {-# NOINLINE [2] f #-} -- No Maybe
|
| 581 | 587 | {-# NOINLINE [~2] f #-} -- Maybe No
|
| 588 | + {-# INLINEABLE [2] f #-} -- No Maybe
|
|
| 589 | + {-# INLINEABLE [~2] f #-} -- Maybe No
|
|
| 582 | 590 | |
| 583 | 591 | {-# INLINE f #-} -- Yes Yes
|
| 584 | 592 | {-# NOINLINE f #-} -- No No
|
| ... | ... | @@ -293,6 +293,16 @@ its :pragma:`RULES` have had a chance to fire. The warning flag |
| 293 | 293 | :ghc-flag:`-Winline-rule-shadowing` (see :ref:`options-sanity`) warns about
|
| 294 | 294 | this situation.
|
| 295 | 295 | |
| 296 | +All of this applies similarly to :pragma:`INLINABLE` (also accepted as
|
|
| 297 | +``INLINABLE``; see :ref:`inline-noinline-pragma`). As with
|
|
| 298 | +the other pragmas, you can use explicit :ref:`phase-control` to delay
|
|
| 299 | +inlining so that a :pragma:`RULES` rewrite has an opportunity to match first.
|
|
| 300 | + |
|
| 301 | +The key difference from :pragma:`INLINE` (see :ref:`inline-pragma`) is that
|
|
| 302 | +:pragma:`INLINABLE` does not guarantee inlining, leaving the inlining decision
|
|
| 303 | +to GHC's usual heuristics. Use :pragma:`INLINE` when your RULE setup relies
|
|
| 304 | +on inlining happening reliably, and :pragma:`INLINABLE` otherwise.
|
|
| 305 | + |
|
| 296 | 306 | .. _conlike:
|
| 297 | 307 | |
| 298 | 308 | How rules interact with ``CONLIKE`` pragmas
|
| ... | ... | @@ -528,4 +538,3 @@ Controlling what's going on in rewrite rules |
| 528 | 538 | see how to write rules that will do fusion and yet give an efficient
|
| 529 | 539 | program even if fusion doesn't happen. More rules in
|
| 530 | 540 | ``GHC/List.hs``. |
| 531 | - |