Fix scoped type variables for expression type signatures
[ghc-hetmet.git] / compiler / coreSyn / CoreUnfold.lhs
index d57f188..6849510 100644 (file)
@@ -36,7 +36,7 @@ import StaticFlags    ( opt_UF_CreationThreshold, opt_UF_UseThreshold,
                        )
 import DynFlags                ( DynFlags, DynFlag(..), dopt )
 import CoreSyn
-import PprCore         ( pprCoreExpr )
+import PprCore         ()      -- Instances
 import OccurAnal       ( occurAnalyseExpr )
 import CoreUtils       ( exprIsHNF, exprIsCheap, exprIsTrivial )
 import Id              ( Id, idType, isId,
@@ -87,6 +87,14 @@ mkUnfolding top_lvl expr
        -- This can occasionally mean that the guidance is very pessimistic;
        -- it gets fixed up next round
 
+instance Outputable Unfolding where
+  ppr NoUnfolding = ptext SLIT("No unfolding")
+  ppr (OtherCon cs) = ptext SLIT("OtherCon") <+> ppr cs
+  ppr (CompulsoryUnfolding e) = ptext SLIT("Compulsory") <+> ppr e
+  ppr (CoreUnfolding e top hnf cheap g) 
+       = ptext SLIT("Unf") <+> sep [ppr top <+> ppr hnf <+> ppr cheap <+> ppr g, 
+                                    ppr e]
+
 mkCompulsoryUnfolding expr     -- Used for things that absolutely must be unfolded
   = CompulsoryUnfolding (occurAnalyseExpr expr)
 \end{code}
@@ -192,6 +200,8 @@ sizeExpr bOMB_OUT_SIZE top_args expr
        -- then we'll get a dfun which is a pair of two INLINE lambdas
 
     size_up (Note _        body) = size_up body        -- Other notes cost nothing
+    
+    size_up (Cast e _)           = size_up e
 
     size_up (App fun (Type t)) = size_up fun
     size_up (App fun arg)      = size_up_app fun [arg]
@@ -492,7 +502,6 @@ StrictAnal.addStrictnessInfoToTopId
 \begin{code}
 callSiteInline :: DynFlags
               -> Bool                  -- True <=> the Id can be inlined
-              -> Bool                  -- 'inline' note at call site
               -> OccInfo
               -> Id                    -- The Id
               -> [Bool]                -- One for each value arg; True if it is interesting
@@ -500,7 +509,7 @@ callSiteInline :: DynFlags
               -> Maybe CoreExpr        -- Unfolding, if any
 
 
-callSiteInline dflags active_inline inline_call occ id arg_infos interesting_cont
+callSiteInline dflags active_inline occ id arg_infos interesting_cont
   = case idUnfolding id of {
        NoUnfolding -> Nothing ;
        OtherCon cs -> Nothing ;
@@ -539,9 +548,6 @@ callSiteInline dflags active_inline inline_call occ id arg_infos interesting_con
                -- consider_safe decides whether it's a good idea to
                -- inline something, given that there's no
                -- work-duplication issue (the caller checks that).
-         | inline_call  = True
-
-         | otherwise
          = case guidance of
              UnfoldNever  -> False
              UnfoldIfGoodArgs n_vals_wanted arg_discounts size res_discount