[commit: ghc] wip/T14068: Prevent inlining of loopified programs (b726f71)

git at git.haskell.org git at git.haskell.org
Fri Aug 18 13:08:55 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T14068
Link       : http://ghc.haskell.org/trac/ghc/changeset/b726f715cfef0e52476b8866308c857c60331ae0/ghc

>---------------------------------------------------------------

commit b726f715cfef0e52476b8866308c857c60331ae0
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Fri Aug 4 15:34:11 2017 -0400

    Prevent inlining of loopified programs
    
    Previously, a recursive function is not inlineable. After loopification,
    it turns into a non-recursive function, and suddenly it is. While this
    is in general desirable, it has many knock-on effects, which makes it
    hard to evaluate and debug loopification. Therefore, this commit (tries to)
    prevent this inlining. When this results in no unfixable regressions,
    then we can tackle the next step.


>---------------------------------------------------------------

b726f715cfef0e52476b8866308c857c60331ae0
 compiler/coreSyn/CoreOpt.hs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs
index 5949cf6..b62c025 100644
--- a/compiler/coreSyn/CoreOpt.hs
+++ b/compiler/coreSyn/CoreOpt.hs
@@ -672,7 +672,11 @@ loopificationJoinPointBinding_maybe bndr rhs
                      localiseId $
                      bndr
         -- RULES etc stay with bindr'
-        bndr' = zapIdTailCallInfo bndr
+        -- Also, previously, the function was recursive, and hence not inlineable.
+        -- To tread with caution, let's keep it this way
+        bndr' = (`setIdUnfolding` noUnfolding) $
+                zapIdTailCallInfo $
+                bndr
     in  Just (bndr', join_bndr, mkLams bndrs body)
 
   | otherwise



More information about the ghc-commits mailing list