[Git][ghc/ghc][master] Clarify INLINE unfolding optimization docs.

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Nov 26 13:25:55 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
fcc3ae6e by Andreas Klebinger at 2024-11-26T08:24:58-05:00
Clarify INLINE unfolding optimization docs.

Fixes #24660

- - - - -


1 changed file:

- docs/users_guide/exts/pragmas.rst


Changes:

=====================================
docs/users_guide/exts/pragmas.rst
=====================================
@@ -393,12 +393,15 @@ has a number of other effects:
    pragmas is to expose functions in ``f``\'s RHS that have rewrite
    rules, and it's no good if those functions have been optimised away.
 
-   So *GHC guarantees to inline precisely the code that you wrote*, no
-   more and no less. It does this by capturing a copy of the definition
+   So *GHC guarantees to behave precisely as if it inlined the code that you wrote*.
+   It does this by capturing a copy of the definition
    of the function to use for inlining (we call this the "inline-RHS"),
-   which it leaves untouched, while optimising the ordinarily RHS as
-   usual. For externally-visible functions the inline-RHS (not the
-   optimised RHS) is recorded in the interface file.
+   which it only optimizes in ways which don't break this promise.
+   For example if inlining is explicitly delayed through phase control GHC will
+   apply optimizations which happen before the ``INLINE`` pragma becomes
+   active to the inline-RHS while optimising the ordinarily RHS as usual.
+   For externally-visible functions
+   the inline-RHS (not the optimised RHS) is recorded in the interface file.
 
 -  An ``INLINE`` function is not worker/wrappered by strictness analysis.
    It's going to be inlined wholesale instead.



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fcc3ae6ec74725804364742f864ded7038e3520d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fcc3ae6ec74725804364742f864ded7038e3520d
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241126/aa9f1891/attachment-0001.html>


More information about the ghc-commits mailing list