@@ -6062,7 +6062,7 @@ index dc8344d14d..b32b383510 100644
60626062 -- condition (first parameter), or are dependencies of those
60636063 -- modules. The second parameter is a condition to check before
60646064diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
6065−index 9bb6b4e391..e4dd13b9d7 100644
6065+index 9bb6b4e391..ce2b2f29b6 100644
60666066--- a/compiler/main/HscMain.hs
60676067+++ b/compiler/main/HscMain.hs
60686068@@ -123,8 +123,10 @@ import MkIface
@@ -6076,7 +6076,16 @@ index 9bb6b4e391..e4dd13b9d7 100644
60766076 import qualified GHC.StgToCmm as StgToCmm ( codeGen )
60776077 import StgSyn
60786078 import StgFVs ( annTopBindingsFreeVars )
6079−@@ -1432,7 +1434,7 @@ hscGenHardCode hsc_env cgguts location output_filename = do
6079+@@ -165,6 +167,8 @@ import Stream (Stream)
6080+ import Util
6081+
6082+ import Data.List ( nub, isPrefixOf, partition )
6083++import Data.Either ( partitionEithers )
6084++
6085+ import Control.Monad
6086+ import Data.IORef
6087+ import System.FilePath as FilePath
6088+@@ -1432,7 +1436,7 @@ hscGenHardCode hsc_env cgguts location output_filename = do
60806089 ----------------- Convert to STG ------------------
60816090 (stg_binds, (caf_ccs, caf_cc_stacks))
60826091 <- {-# SCC "CoreToStg" #-}
@@ -6085,7 +6094,7 @@ index 9bb6b4e391..e4dd13b9d7 100644
60856094
60866095 let cost_centre_info =
60876096 (S.toList local_ccs ++ caf_ccs, caf_cc_stacks)
6088−@@ -1494,8 +1496,12 @@ hscInteractive hsc_env cgguts location = do
6097+@@ -1494,8 +1498,12 @@ hscInteractive hsc_env cgguts location = do
60896098 -- Do saturation and convert to A-normal form
60906099 (prepd_binds, _) <- {-# SCC "CorePrep" #-}
60916100 corePrepPgm hsc_env this_mod location core_binds data_tycons
@@ -6099,7 +6108,7 @@ index 9bb6b4e391..e4dd13b9d7 100644
60996108 ------------------ Create f-x-dynamic C-side stuff -----
61006109 (_istub_h_exists, istub_c_exists)
61016110 <- outputForeignStubs dflags this_mod location foreign_stubs
6102−@@ -1572,21 +1578,20 @@ doCodeGen hsc_env this_mod data_tycons
6111+@@ -1572,21 +1580,20 @@ doCodeGen hsc_env this_mod data_tycons
61036112
61046113
61056114
@@ -6125,7 +6134,7 @@ index 9bb6b4e391..e4dd13b9d7 100644
61256134 {- **********************************************************************
61266135 %* *
61276136 \subsection{Compiling a do-statement}
6128−@@ -1722,9 +1727,13 @@ hscParsedDecls hsc_env decls = runInteractiveHsc hsc_env $ do
6137+@@ -1722,9 +1729,13 @@ hscParsedDecls hsc_env decls = runInteractiveHsc hsc_env $ do
61296138 (prepd_binds, _) <- {-# SCC "CorePrep" #-}
61306139 liftIO $ corePrepPgm hsc_env this_mod iNTERACTIVELoc core_binds data_tycons
61316140
@@ -6140,7 +6149,7 @@ index 9bb6b4e391..e4dd13b9d7 100644
61406149
61416150 let src_span = srcLocSpan interactiveSrcLoc
61426151 liftIO $ linkDecls hsc_env src_span cbc
6143−@@ -1887,9 +1896,20 @@ hscCompileCoreExpr' hsc_env srcspan ds_expr
6152+@@ -1887,9 +1898,38 @@ hscCompileCoreExpr' hsc_env srcspan ds_expr
61446153 {- Lint if necessary -}
61456154 ; lintInteractiveExpr "hscCompileExpr" hsc_env prepd_expr
61466155
@@ -6148,10 +6157,28 @@ index 9bb6b4e391..e4dd13b9d7 100644
61486157+ ; let bco_tmp_id = mkSysLocal (fsLit "BCO_toplevel")
61496158+ (mkPseudoUniqueE 0)
61506159+ (exprType prepd_expr)
6151−+ ; ([StgTopLifted (StgNonRec _ stg_expr)], _) <-
6160++ ; (binds, _) <-
61526161+ myCoreToStg hsc_env
61536162+ (icInteractiveModule (hsc_IC hsc_env))
61546163+ [NonRec bco_tmp_id prepd_expr]
6164++
6165++ ; let (_strings, lifted_binds) = partitionEithers $ do -- list monad
6166++ bnd <- binds
6167++ case bnd of
6168++ StgTopLifted (StgNonRec i expr) -> [Right (i, expr)]
6169++ StgTopLifted (StgRec bnds) -> map Right bnds
6170++ StgTopStringLit b str -> [Left (b, str)]
6171++
6172++ ; let stg_expr = case lifted_binds of
6173++ [(_i, e)] -> e
6174++ _ ->
6175++ StgRhsClosure noExtFieldSilent
6176++ dontCareCCS
6177++ ReEntrant
6178++ []
6179++ (StgLet noExtFieldSilent
6180++ (StgRec lifted_binds)
6181++ (StgApp bco_tmp_id []))
61556182+
61566183 {- Convert to BCOs -}
61576184 ; bcos <- coreExprToBCOs hsc_env