Simon Peyton Jones pushed to branch wip/T26831 at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/CoreToStg/Prep.hs
    ... ... @@ -143,16 +143,13 @@ Here is the syntax of the Core produced by CorePrep:
    143 143
     
    
    144 144
         Expressions
    
    145 145
            body ::= app
    
    146
    -             |  let(rec) x = rhs in body     -- Boxed only
    
    146
    +             |  let(rec) x = body in body     -- Boxed only
    
    147 147
                  |  case body of pat -> body
    
    148
    -             |  /\a. body | /\c. body
    
    148
    +             |  /\a. body | /\c. body | \x. body
    
    149 149
                  |  body |> co
    
    150 150
     
    
    151
    -    Right hand sides (only place where value lambdas can occur)
    
    152
    -       rhs ::= /\a.rhs  |  \x.rhs  |  body
    
    153
    -
    
    154
    -We define a synonym for each of these non-terminals.  Functions
    
    155
    -with the corresponding name produce a result in that syntax.
    
    151
    +We define a synonym for each of these non-terminals, CpeArg, CpeApp, and
    
    152
    +CpeBody.  Functions with the corresponding name produce a result in that syntax.
    
    156 153
     
    
    157 154
     Note [Cloning in CorePrep]
    
    158 155
     ~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    ... ... @@ -217,7 +214,6 @@ So our plan is:
    217 214
     type CpeArg  = CoreExpr    -- Non-terminal 'arg'
    
    218 215
     type CpeApp  = CoreExpr    -- Non-terminal 'app'
    
    219 216
     type CpeBody = CoreExpr    -- Non-terminal 'body'
    
    220
    -type CpeRhs  = CoreExpr    -- Non-terminal 'rhs'
    
    221 217
     
    
    222 218
     {-
    
    223 219
     ************************************************************************
    
    ... ... @@ -260,7 +256,7 @@ corePrepExpr logger config expr = do
    260 256
         withTiming logger (text "CorePrep [expr]") (\e -> e `seq` ()) $ do
    
    261 257
           us <- mkSplitUniqSupply StgTag
    
    262 258
           let initialCorePrepEnv = mkInitialCorePrepEnv config
    
    263
    -      let new_expr = initUs_ us (cpeBodyNF initialCorePrepEnv expr)
    
    259
    +      let new_expr = initUs_ us (cpeBody initialCorePrepEnv expr)
    
    264 260
           putDumpFileMaybe logger Opt_D_dump_prep "CorePrep" FormatCore (ppr new_expr)
    
    265 261
           return new_expr
    
    266 262
     
    
    ... ... @@ -657,7 +653,7 @@ cpeBind top_lvl env (Rec pairs)
    657 653
     ---------------
    
    658 654
     cpePair :: TopLevelFlag -> RecFlag -> Demand -> Levity
    
    659 655
             -> CorePrepEnv -> OutId -> CoreExpr
    
    660
    -        -> UniqSM (Floats, CpeRhs)
    
    656
    +        -> UniqSM (Floats, CpeBody)
    
    661 657
     -- Used for all bindings
    
    662 658
     -- The binder is already cloned, hence an OutId
    
    663 659
     cpePair top_lvl is_rec dmd lev env0 bndr rhs
    
    ... ... @@ -666,7 +662,7 @@ cpePair top_lvl is_rec dmd lev env0 bndr rhs
    666 662
     
    
    667 663
            -- See if we are allowed to float this stuff out of the RHS
    
    668 664
            ; let dec = want_float_from_rhs floats1 rhs1
    
    669
    -       ; (floats2, rhs2) <- executeFloatDecision env dec floats1 rhs1
    
    665
    +             (floats2, rhs2) = executeFloatDecision dec floats1 rhs1
    
    670 666
     
    
    671 667
            -- Make the arity match up
    
    672 668
            ; (floats3, rhs3)
    
    ... ... @@ -709,7 +705,7 @@ it seems good for CorePrep to be robust.
    709 705
     
    
    710 706
     ---------------
    
    711 707
     cpeJoinPair :: CorePrepEnv -> JoinId -> CoreExpr
    
    712
    -            -> UniqSM (JoinId, CpeRhs)
    
    708
    +            -> UniqSM (JoinId, CpeBody)
    
    713 709
     -- Used for all join bindings
    
    714 710
     -- No eta-expansion: see Note [Do not eta-expand join points] in GHC.Core.Opt.Simplify.Utils
    
    715 711
     cpeJoinPair env bndr rhs
    
    ... ... @@ -721,7 +717,7 @@ cpeJoinPair env bndr rhs
    721 717
     
    
    722 718
            ; (env', bndrs') <- cpCloneBndrs env bndrs
    
    723 719
     
    
    724
    -       ; body' <- cpeBodyNF env' body -- Will let-bind the body if it starts
    
    720
    +       ; body' <- cpeBody env' body -- Will let-bind the body if it starts
    
    725 721
                                           -- with a lambda
    
    726 722
     
    
    727 723
            ; let rhs'  = mkCoreLams bndrs' body'
    
    ... ... @@ -749,10 +745,20 @@ for us to mess with the arity because a join point is never exported.
    749 745
     -}
    
    750 746
     
    
    751 747
     -- ---------------------------------------------------------------------------
    
    752
    ---              CpeRhs: produces a result satisfying CpeRhs
    
    748
    +--              cpeRhsE: produces a result satisfying CpeBody
    
    753 749
     -- ---------------------------------------------------------------------------
    
    754 750
     
    
    755
    -cpeRhsE :: CorePrepEnv -> CoreExpr -> UniqSM (Floats, CpeRhs)
    
    751
    +cpeRhsE :: CorePrepEnv -> CoreExpr -> UniqSM (Floats, CpeBody)
    
    752
    +-- | Convert a 'CoreExpr' so it satisfies 'CpeBody'; also produce
    
    753
    +-- a list of 'Floats' which are being propagated upwards.  In
    
    754
    +-- fact, this function is used in only two cases: to
    
    755
    +-- implement 'cpeBody' (which is what you usually want),
    
    756
    +-- and in the case when a let-binding is in a case scrutinee--here,
    
    757
    +-- we can always float out:
    
    758
    +--
    
    759
    +--      case (let x = y in z) of ...
    
    760
    +--      ==> let x = y in case z of ...
    
    761
    +--
    
    756 762
     -- If
    
    757 763
     --      e  ===>  (bs, e')
    
    758 764
     -- then
    
    ... ... @@ -786,7 +792,7 @@ cpeRhsE env (Tick tickish expr)
    786 792
              -- See [Floating Ticks in CorePrep]
    
    787 793
            ; return (FloatTick tickish `consFloat` floats, body) }
    
    788 794
       | otherwise
    
    789
    -  = do { body <- cpeBodyNF env expr
    
    795
    +  = do { body <- cpeBody env expr
    
    790 796
            ; return (emptyFloats, mkTick tickish' body) }
    
    791 797
       where
    
    792 798
         tickish' | Breakpoint ext bid fvs <- tickish
    
    ... ... @@ -802,7 +808,7 @@ cpeRhsE env (Cast expr co)
    802 808
     cpeRhsE env expr@(Lam {})
    
    803 809
        = do { let (bndrs,body) = collectBinders expr
    
    804 810
             ; (env', bndrs') <- cpCloneBndrs env bndrs
    
    805
    -        ; body' <- cpeBodyNF env' body
    
    811
    +        ; body' <- cpeBody env' body
    
    806 812
             ; return (emptyFloats, mkLams bndrs' body') }
    
    807 813
     
    
    808 814
     cpeRhsE env (Case scrut bndr _ alts@[Alt con [covar] _])
    
    ... ... @@ -820,7 +826,7 @@ cpeRhsE env (Case scrut bndr _ alts@[Alt con [covar] _])
    820 826
       -- Note that `x` is a value here. This is visible in the GHCi debugger tests
    
    821 827
       -- (such as `print003`).
    
    822 828
       | Just rhs <- isUnsafeEqualityCase scrut bndr alts
    
    823
    -  = do { (floats_scrut, scrut) <- cpeBody env scrut
    
    829
    +  = do { (floats_scrut, scrut) <- cpeRhsE env scrut
    
    824 830
     
    
    825 831
            ; (env, bndr')  <- cpCloneBndr env bndr
    
    826 832
            ; (env, covar') <- cpCloneCoVarBndr env covar
    
    ... ... @@ -829,7 +835,7 @@ cpeRhsE env (Case scrut bndr _ alts@[Alt con [covar] _])
    829 835
     
    
    830 836
              -- Up until here this should do exactly the same as the regular code
    
    831 837
              -- path of `cpeRhsE Case{}`.
    
    832
    -       ; (floats_rhs, rhs) <- cpeBody env rhs
    
    838
    +       ; (floats_rhs, rhs) <- cpeRhsE env rhs
    
    833 839
              -- ... but we want to float `floats_rhs` as in (U3) so that rhs' might
    
    834 840
              -- become a value
    
    835 841
            ; let case_float = UnsafeEqualityCase scrut bndr' con [covar']
    
    ... ... @@ -864,7 +870,7 @@ cpeRhsE env (Case scrut bndr _ [Alt (DataAlt dc) [token_out, res] rhs])
    864 870
       = cpeRhsE (extendCorePrepEnv env token_out token_in') rhs
    
    865 871
     
    
    866 872
     cpeRhsE env (Case scrut bndr ty alts)
    
    867
    -  = do { (floats, scrut') <- cpeBody env scrut
    
    873
    +  = do { (floats, scrut') <- cpeRhsE env scrut
    
    868 874
            ; (env', bndr2) <- cpCloneBndr env bndr
    
    869 875
            ; let bndr3 = bndr2 `setIdUnfolding` evaldUnfolding
    
    870 876
            ; let alts'
    
    ... ... @@ -888,7 +894,7 @@ cpeRhsE env (Case scrut bndr ty alts)
    888 894
       where
    
    889 895
         sat_alt env (Alt con bs rhs)
    
    890 896
            = do { (env2, bs') <- cpCloneBndrs env bs
    
    891
    -            ; rhs' <- cpeBodyNF env2 rhs
    
    897
    +            ; rhs' <- cpeBody env2 rhs
    
    892 898
                 ; return (Alt con bs' rhs') }
    
    893 899
     
    
    894 900
     -- ---------------------------------------------------------------------------
    
    ... ... @@ -900,76 +906,11 @@ cpeRhsE env (Case scrut bndr ty alts)
    900 906
     -- let-bound using 'wrapBinds').  Generally you want this, esp.
    
    901 907
     -- when you've reached a binding form (e.g., a lambda) and
    
    902 908
     -- floating any further would be incorrect.
    
    903
    -cpeBodyNF :: CorePrepEnv -> CoreExpr -> UniqSM CpeBody
    
    904
    -cpeBodyNF env expr
    
    905
    -  = do { (floats, body) <- cpeBody env expr
    
    906
    -       ; return (wrapBinds floats body) }
    
    907
    -
    
    908
    --- | Convert a 'CoreExpr' so it satisfies 'CpeBody'; also produce
    
    909
    --- a list of 'Floats' which are being propagated upwards.  In
    
    910
    --- fact, this function is used in only two cases: to
    
    911
    --- implement 'cpeBodyNF' (which is what you usually want),
    
    912
    --- and in the case when a let-binding is in a case scrutinee--here,
    
    913
    --- we can always float out:
    
    914
    ---
    
    915
    ---      case (let x = y in z) of ...
    
    916
    ---      ==> let x = y in case z of ...
    
    917
    ---
    
    918
    -cpeBody :: CorePrepEnv -> CoreExpr -> UniqSM (Floats, CpeBody)
    
    909
    +cpeBody :: CorePrepEnv -> CoreExpr -> UniqSM CpeBody
    
    919 910
     cpeBody env expr
    
    920
    -  = do { (floats1, rhs) <- cpeRhsE env expr
    
    921
    -       ; (floats2, body) <- rhsToBody env rhs
    
    922
    -       ; return (floats1 `appFloats` floats2, body) }
    
    923
    -
    
    924
    ---------
    
    925
    -rhsToBody :: CorePrepEnv -> CpeRhs -> UniqSM (Floats, CpeBody)
    
    926
    --- Remove top level lambdas by let-binding
    
    927
    -
    
    928
    -{-
    
    929
    -rhsToBody env (Tick t expr)
    
    930
    -  | tickishScoped t == NoScope  -- only float out of non-scoped annotations
    
    931
    -  = do { (floats, expr') <- rhsToBody env expr
    
    932
    -       ; return (floats, mkTick t expr') }
    
    933
    -
    
    934
    -rhsToBody env (Cast e co)
    
    935
    -        -- You can get things like
    
    936
    -        --      case e of { p -> coerce t (\s -> ...) }
    
    937
    -  = do { (floats, e') <- rhsToBody env e
    
    938
    -       ; return (floats, Cast e' co) }
    
    939
    -
    
    940
    -rhsToBody env expr@(Lam {})   -- See Note [No eta reduction needed in rhsToBody]
    
    941
    -  | all isTyVar bndrs           -- Type lambdas are ok
    
    942
    -  = return (emptyFloats, expr)
    
    943
    -  | otherwise                   -- Some value lambdas
    
    944
    -  = do { let rhs = cpeEtaExpand (exprArity expr) expr
    
    945
    -       ; fn <- newVar env (exprType rhs)
    
    946
    -       ; let float = Float (NonRec fn rhs) LetBound TopLvlFloatable
    
    947
    -       ; return (unitFloat float, Var fn) }
    
    948
    -  where
    
    949
    -    (bndrs,_) = collectBinders expr
    
    950
    --}
    
    951
    -
    
    952
    -rhsToBody _env expr = return (emptyFloats, expr)
    
    953
    -
    
    954
    -
    
    955
    -{- Note [No eta reduction needed in rhsToBody]
    
    956
    -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    957
    -Historical note.  In the olden days we used to have a Prep-specific
    
    958
    -eta-reduction step in rhsToBody:
    
    959
    -  rhsToBody expr@(Lam {})
    
    960
    -    | Just no_lam_result <- tryEtaReducePrep bndrs body
    
    961
    -    = return (emptyFloats, no_lam_result)
    
    962
    -
    
    963
    -The goal was to reduce
    
    964
    -        case x of { p -> \xs. map f xs }
    
    965
    -    ==> case x of { p -> map f }
    
    966
    -
    
    967
    -to avoid allocating a lambda.  Of course, we'd allocate a PAP
    
    968
    -instead, which is hardly better, but that's the way it was.
    
    911
    +  = do { (floats, body) <- cpeRhsE env expr
    
    912
    +       ; return (wrapBinds floats body) }
    
    969 913
     
    
    970
    -Now we simply don't bother with this. It doesn't seem to be a win,
    
    971
    -and it's extra work.
    
    972
    --}
    
    973 914
     
    
    974 915
     -- ---------------------------------------------------------------------------
    
    975 916
     --              CpeApp: produces a result satisfying CpeApp
    
    ... ... @@ -1023,8 +964,8 @@ cpe_app filters out the tick as a underscoped tick on the expression
    1023 964
     `tagToEnum# @Bool`. During eta expansion we then put that tick back onto the
    
    1024 965
     body of the eta-expansion lambdas. Giving us `\x -> Tick<foo> (tagToEnum# @Bool x)`.
    
    1025 966
     -}
    
    1026
    -cpeApp :: CorePrepEnv -> CoreExpr -> UniqSM (Floats, CpeRhs)
    
    1027
    --- May return a CpeRhs (instead of CpeApp) because of saturating primops
    
    967
    +cpeApp :: CorePrepEnv -> CoreExpr -> UniqSM (Floats, CpeBody)
    
    968
    +-- May return a CpeBody (instead of CpeApp) because of saturating primops
    
    1028 969
     cpeApp top_env expr
    
    1029 970
       = do { let (terminal, args) = collect_args expr
    
    1030 971
           --  ; pprTraceM "cpeApp" $ (ppr expr)
    
    ... ... @@ -1067,7 +1008,7 @@ cpeApp top_env expr
    1067 1008
         cpe_app :: CorePrepEnv
    
    1068 1009
                 -> CoreExpr -- The thing we are calling
    
    1069 1010
                 -> [ArgInfo]
    
    1070
    -            -> UniqSM (Floats, CpeRhs)
    
    1011
    +            -> UniqSM (Floats, CpeBody)
    
    1071 1012
         cpe_app env (Var f) (AIApp Type{} : AIApp arg : args)
    
    1072 1013
             | f `hasKey` lazyIdKey          -- Replace (lazy a) with a, and
    
    1073 1014
                 -- See Note [lazyId magic] in GHC.Types.Id.Make
    
    ... ... @@ -1120,7 +1061,7 @@ cpeApp top_env expr
    1120 1061
             --          case thing of res { __DEFAULT -> (# token, res#) } },
    
    1121 1062
             -- allocating CaseBound Floats for token and thing as needed
    
    1122 1063
             = do { (floats1, token) <- cpeArg env topDmd token
    
    1123
    -             ; (floats2, thing) <- cpeBody env thing
    
    1064
    +             ; (floats2, thing) <- cpeRhsE env thing
    
    1124 1065
                  ; case_bndr <- (`setIdUnfolding` evaldUnfolding) <$> newVar env ty
    
    1125 1066
                  ; let tup = mkCoreUnboxedTuple [token, Var case_bndr]
    
    1126 1067
                  ; let float = mkCaseFloat case_bndr thing
    
    ... ... @@ -1134,9 +1075,10 @@ cpeApp top_env expr
    1134 1075
                      min_arity = case hd of
    
    1135 1076
                        Just v_hd -> if hasNoBinding v_hd then Just $! (idArity v_hd) else Nothing
    
    1136 1077
                        Nothing -> Nothing
    
    1137
    -          --  ; pprTraceM "cpe_app:stricts:" (ppr v <+> ppr args $$ ppr stricts $$ ppr (idCbvMarks_maybe v))
    
    1138 1078
                ; (app, floats, unsat_ticks) <- rebuild_app env args e2 emptyFloats stricts min_arity
    
    1139
    -           ; mb_saturate hd app floats unsat_ticks depth }
    
    1079
    +           ; case hd of
    
    1080
    +               Nothing    -> do { massert (null unsat_ticks); return (floats, app) }
    
    1081
    +               Just fn_id -> return (floats, maybeSaturate fn_id app depth unsat_ticks) }
    
    1140 1082
             where
    
    1141 1083
               depth = val_args args
    
    1142 1084
               stricts = case idDmdSig v of
    
    ... ... @@ -1163,7 +1105,8 @@ cpeApp top_env expr
    1163 1105
                               -- If evalDmd says that it's sure to be evaluated,
    
    1164 1106
                               -- we'll end up case-binding it
    
    1165 1107
                ; (app, floats,unsat_ticks) <- rebuild_app env args fun' fun_floats [] Nothing
    
    1166
    -           ; mb_saturate Nothing app floats unsat_ticks (val_args args) }
    
    1108
    +           ; massert (null unsat_ticks)
    
    1109
    +           ; return (floats, app) }
    
    1167 1110
     
    
    1168 1111
         -- Count the number of value arguments *and* coercions (since we don't eliminate the later in STG)
    
    1169 1112
         val_args :: [ArgInfo] -> Int
    
    ... ... @@ -1184,13 +1127,6 @@ cpeApp top_env expr
    1184 1127
                       | isTypeArg e = n
    
    1185 1128
                       | otherwise   = n+1
    
    1186 1129
     
    
    1187
    -    -- Saturate if necessary
    
    1188
    -    mb_saturate head app floats unsat_ticks depth =
    
    1189
    -       case head of
    
    1190
    -         Just fn_id -> do { sat_app <- maybeSaturate fn_id app depth unsat_ticks
    
    1191
    -                          ; return (floats, sat_app) }
    
    1192
    -         _other     -> do { massert (null unsat_ticks)
    
    1193
    -                          ; return (floats, app) }
    
    1194 1130
     
    
    1195 1131
         -- Deconstruct and rebuild the application, floating any non-atomic
    
    1196 1132
         -- arguments to the outside.  We collect the type of the expression,
    
    ... ... @@ -1526,7 +1462,7 @@ cpeArg env dmd arg
    1526 1462
            ; let arg_ty = exprType arg1
    
    1527 1463
                  lev    = typeLevity arg_ty
    
    1528 1464
                  dec    = wantFloatLocal NonRecursive dmd lev floats1 arg1
    
    1529
    -       ; (floats2, arg2) <- executeFloatDecision env dec floats1 arg1
    
    1465
    +             (floats2, arg2) = executeFloatDecision dec floats1 arg1
    
    1530 1466
                     -- Else case: arg1 might have lambdas, and we can't
    
    1531 1467
                     --            put them inside a wrapBinds
    
    1532 1468
     
    
    ... ... @@ -1583,17 +1519,17 @@ eta_would_wreck_join (Tick _ e) = eta_would_wreck_join e
    1583 1519
     eta_would_wreck_join (Case _ _ _ alts) = any eta_would_wreck_join (rhssOfAlts alts)
    
    1584 1520
     eta_would_wreck_join _                 = False
    
    1585 1521
     
    
    1586
    -maybeSaturate :: Id -> CpeApp -> Int -> [CoreTickish] -> UniqSM CpeRhs
    
    1522
    +maybeSaturate :: Id -> CpeApp -> Int -> [CoreTickish] -> CpeBody
    
    1587 1523
     maybeSaturate fn expr n_args unsat_ticks
    
    1588 1524
       | isJoinId fn  -- Never eta-expand a call to a join point
    
    1589 1525
                      -- See Note [Do not eta-expand join points]
    
    1590
    -  = return expr
    
    1526
    +  = expr
    
    1591 1527
       | hasNoBinding fn || (n_args > 0 && excess_arity > 0)
    
    1592 1528
         -- n_args > 0: do not eta-expand a naked variable!
    
    1593 1529
         -- excess_arity > 0: eta-expansion would be a no-op
    
    1594
    -  = return $ wrapLamBody (mkTicks unsat_ticks) sat_expr
    
    1530
    +  = wrapLamBody (mkTicks unsat_ticks) sat_expr
    
    1595 1531
       | otherwise
    
    1596
    -  = return expr
    
    1532
    +  = expr
    
    1597 1533
     
    
    1598 1534
     {-
    
    1599 1535
       | hasNoBinding fn        -- There's no binding
    
    ... ... @@ -1672,7 +1608,7 @@ Note [Eta expansion and the CorePrep invariants]
    1672 1608
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    1673 1609
     It turns out to be much much easier to do eta expansion
    
    1674 1610
     *after* the main CorePrep stuff.  But that places constraints
    
    1675
    -on the eta expander: given a CpeRhs, it must return a CpeRhs.
    
    1611
    +on the eta expander: given a CpeBody, it must return a CpeBody.
    
    1676 1612
     
    
    1677 1613
     For example here is what we do not want:
    
    1678 1614
                     f = /\a -> g (h 3)      -- h has arity 2
    
    ... ... @@ -1776,7 +1712,7 @@ There is a nasty Wrinkle:
    1776 1712
           #24471 is a good example, where Prep took 25% of compile time!
    
    1777 1713
     -}
    
    1778 1714
     
    
    1779
    -cpeEtaExpand :: Arity -> CpeRhs -> CpeRhs
    
    1715
    +cpeEtaExpand :: Arity -> CpeBody -> CpeBody
    
    1780 1716
     cpeEtaExpand arity expr
    
    1781 1717
       | arity == 0 = expr
    
    1782 1718
       | otherwise  = etaExpand arity expr
    
    ... ... @@ -2143,9 +2079,6 @@ isEmptyFloats (Floats _ b) = isNilOL b
    2143 2079
     getFloats :: Floats -> OrdList FloatingBind
    
    2144 2080
     getFloats = fs_binds
    
    2145 2081
     
    
    2146
    -unitFloat :: FloatingBind -> Floats
    
    2147
    -unitFloat = snocFloat emptyFloats
    
    2148
    -
    
    2149 2082
     floatInfo :: FloatingBind -> FloatInfo
    
    2150 2083
     floatInfo (Float _ _ info)     = info
    
    2151 2084
     floatInfo UnsafeEqualityCase{} = LazyContextFloatable -- See Note [Floating in CorePrep]
    
    ... ... @@ -2233,7 +2166,7 @@ decideFloatInfo FIA{fia_levity=lev, fia_demand=dmd, fia_is_hnf=is_hnf,
    2233 2166
       | Lifted   <- lev       = (LetBound, TopLvlFloatable)
    
    2234 2167
           -- And these float freely but can't be speculated, hence LetBound
    
    2235 2168
     
    
    2236
    -mkCaseFloat :: Id -> CpeRhs -> FloatingBind
    
    2169
    +mkCaseFloat :: Id -> CpeBody -> FloatingBind
    
    2237 2170
     mkCaseFloat bndr scrut
    
    2238 2171
       = -- pprTrace "mkCaseFloat" (ppr bndr <+> ppr (bound,info)
    
    2239 2172
         --                             -- <+> ppr is_lifted <+> ppr is_strict
    
    ... ... @@ -2251,7 +2184,7 @@ mkCaseFloat bndr scrut
    2251 2184
               -- (ok-for-spec case bindings are unlikely anyway.)
    
    2252 2185
           }
    
    2253 2186
     
    
    2254
    -mkNonRecFloat :: CorePrepEnv -> Levity -> Id -> CpeRhs -> (FloatingBind, Id)
    
    2187
    +mkNonRecFloat :: CorePrepEnv -> Levity -> Id -> CpeBody -> (FloatingBind, Id)
    
    2255 2188
     mkNonRecFloat env lev bndr rhs
    
    2256 2189
       = -- pprTrace "mkNonRecFloat" (ppr bndr <+> ppr (bound,info)
    
    2257 2190
         --                             <+> if is_strict then text "strict" else if is_lifted then text "lazy" else text "unlifted"
    
    ... ... @@ -2391,24 +2324,18 @@ instance Outputable FloatDecision where
    2391 2324
       ppr FloatNone = text "none"
    
    2392 2325
       ppr FloatAll  = text "all"
    
    2393 2326
     
    
    2394
    -executeFloatDecision :: CorePrepEnv -> FloatDecision -> Floats -> CpeRhs -> UniqSM (Floats, CpeRhs)
    
    2395
    -executeFloatDecision env dec floats rhs
    
    2327
    +executeFloatDecision :: FloatDecision -> Floats -> CpeBody -> (Floats, CpeBody)
    
    2328
    +executeFloatDecision dec floats rhs
    
    2396 2329
       = case dec of
    
    2397
    -      FloatAll                 -> return (floats, rhs)
    
    2398
    -      FloatNone
    
    2399
    -        | isEmptyFloats floats -> return (emptyFloats, rhs)
    
    2400
    -        | otherwise            -> do { (floats', body) <- rhsToBody env rhs
    
    2401
    -                                     ; return (emptyFloats, wrapBinds floats $
    
    2402
    -                                                            wrapBinds floats' body) }
    
    2403
    -            -- FloatNone case: `rhs` might have lambdas, and we can't
    
    2404
    -            -- put them inside a wrapBinds, which expects a `CpeBody`.
    
    2330
    +      FloatAll  -> (floats,      rhs)
    
    2331
    +      FloatNone -> (emptyFloats, wrapBinds floats rhs)
    
    2405 2332
     
    
    2406 2333
     wantFloatTop :: Floats -> FloatDecision
    
    2407 2334
     wantFloatTop fs
    
    2408 2335
       | fs_info fs `floatsAtLeastAsFarAs` TopLvlFloatable = FloatAll
    
    2409 2336
       | otherwise                                         = FloatNone
    
    2410 2337
     
    
    2411
    -wantFloatLocal :: RecFlag -> Demand -> Levity -> Floats -> CpeRhs -> FloatDecision
    
    2338
    +wantFloatLocal :: RecFlag -> Demand -> Levity -> Floats -> CpeBody -> FloatDecision
    
    2412 2339
     -- See Note [wantFloatLocal]
    
    2413 2340
     wantFloatLocal is_rec rhs_dmd rhs_lev floats rhs
    
    2414 2341
       |  isEmptyFloats floats -- Well yeah...
    
    ... ... @@ -2761,8 +2688,7 @@ wrapTicks floats expr
    2761 2688
     -- ---------------------------------------------------------------------------
    
    2762 2689
     
    
    2763 2690
     -- | Converts Bignum literals into their final CoreExpr
    
    2764
    -cpeBigNatLit
    
    2765
    -   :: CorePrepEnv -> Integer -> UniqSM (Floats, CpeRhs)
    
    2691
    +cpeBigNatLit :: CorePrepEnv -> Integer -> UniqSM (Floats, CpeBody)
    
    2766 2692
     cpeBigNatLit env i = assert (i >= 0) $ do
    
    2767 2693
       let
    
    2768 2694
         platform = cp_platform (cpe_config env)