summaryrefslogtreecommitdiff
path: root/compiler/prelude
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2009-11-19 12:57:11 +0000
committersimonpj@microsoft.com <unknown>2009-11-19 12:57:11 +0000
commit6a944ae7fe1e8e2e456c68717188463263f8978f (patch)
tree8a190b684af10b9e4fef1ed6ad397b0d346dc055 /compiler/prelude
parentc93e8323ab49dd369e8b5f04027462a6fc1b8249 (diff)
downloadhaskell-6a944ae7fe1e8e2e456c68717188463263f8978f.tar.gz
Implement -fexpose-all-unfoldings, and fix a non-termination bug
The -fexpose-all-unfoldings flag arranges to put unfoldings for *everything* in the interface file. Of course, this makes the file a lot bigger, but it also makes it complete, and that's great for supercompilation; or indeed any whole-program work. Consequences: * Interface files need to record loop-breaker-hood. (Previously, loop breakers were never exposed, so that info wasn't necessary.) Hence a small interface file format change. * When inlining, must check loop-breaker-hood. (Previously, loop breakers didn't have an unfolding at all, so no need to check.) * Ditto in exprIsConApp_maybe. Roman actually tripped this bug, because a DFun, which had an unfolding, was also a loop breaker * TidyPgm.tidyIdInfo must be careful to preserve loop-breaker-hood So Id.idUnfolding checks for loop-breaker-hood and returns NoUnfolding if so. When you want the unfolding regardless of loop-breaker-hood, use Id.realIdUnfolding. I have not documented the flag yet, because it's experimental. Nor have I tested it thoroughly. But with the flag off (the normal case) everything should work.
Diffstat (limited to 'compiler/prelude')
-rw-r--r--compiler/prelude/PrelRules.lhs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/prelude/PrelRules.lhs b/compiler/prelude/PrelRules.lhs
index 236cee6074..1515fb9827 100644
--- a/compiler/prelude/PrelRules.lhs
+++ b/compiler/prelude/PrelRules.lhs
@@ -21,7 +21,7 @@ module PrelRules ( primOpRules, builtinRules ) where
import CoreSyn
import MkCore ( mkWildCase )
-import Id ( idUnfolding )
+import Id ( realIdUnfolding )
import Literal ( Literal(..), mkMachInt, mkMachWord
, literalType
, word2IntLit, int2WordLit
@@ -551,7 +551,7 @@ match_eq_string _ = Nothing
---------------------------------------------------
-- The rule is this:
-- inline f_ty (f a b c) = <f's unfolding> a b c
--- (if f has an unfolding)
+-- (if f has an unfolding, EVEN if it's a loop breaker)
--
-- It's important to allow the argument to 'inline' to have args itself
-- (a) because its more forgiving to allow the programmer to write
@@ -564,7 +564,7 @@ match_eq_string _ = Nothing
match_inline :: [Expr CoreBndr] -> Maybe (Expr CoreBndr)
match_inline (Type _ : e : _)
| (Var f, args1) <- collectArgs e,
- Just unf <- maybeUnfoldingTemplate (idUnfolding f)
+ Just unf <- maybeUnfoldingTemplate (realIdUnfolding f)
= Just (mkApps unf args1)
match_inline _ = Nothing