X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FsimplCore%2FSimplify.lhs;h=f718bcb7849675976655b4ab21590cdfcc99a233;hb=90b9566607ef837329434657c8fabc4bdffdf1af;hp=80fced5bd91c236f8f9df8b04fa31d455e6844c9;hpb=53f99d8465ec50f7c37c65658fa346094bd37ded;p=ghc-hetmet.git diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs index 80fced5..f718bcb 100644 --- a/compiler/simplCore/Simplify.lhs +++ b/compiler/simplCore/Simplify.lhs @@ -521,7 +521,7 @@ makeTrivial env expr | exprIsTrivial expr = return (env, expr) | otherwise -- See Note [Take care] below - = do { var <- newId FSLIT("a") (exprType expr) + = do { var <- newId (fsLit "a") (exprType expr) ; env' <- completeNonRecX env False var var expr ; return (env', substExpr env' (Var var)) } \end{code} @@ -1265,15 +1265,18 @@ inlined. Note [no-case-of-case] ~~~~~~~~~~~~~~~~~~~~~~ -There is a time we *don't* want to do that, namely when --fno-case-of-case is on. This happens in the first simplifier pass, -and enhances full laziness. Here's the bad case: - f = \ y -> ...(case x of I# v -> ...(case x of ...) ... ) -If we eliminate the inner case, we trap it inside the I# v -> arm, -which might prevent some full laziness happening. I've seen this -in action in spectral/cichelli/Prog.hs: - [(m,n) | m <- [1..max], n <- [1..max]] -Hence the check for NoCaseOfCase. +We *used* to suppress the binder-swap in case expressoins when +-fno-case-of-case is on. Old remarks: + "This happens in the first simplifier pass, + and enhances full laziness. Here's the bad case: + f = \ y -> ...(case x of I# v -> ...(case x of ...) ... ) + If we eliminate the inner case, we trap it inside the I# v -> arm, + which might prevent some full laziness happening. I've seen this + in action in spectral/cichelli/Prog.hs: + [(m,n) | m <- [1..max], n <- [1..max]] + Hence the check for NoCaseOfCase." +However, now the full-laziness pass itself reverses the binder-swap, so this +check is no longer necessary. Note [Suppressing the case binder-swap] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1485,7 +1488,7 @@ simplCaseBinder env0 scrut0 case_bndr0 alts improve_seq fam_envs env scrut case_bndr case_bndr1 [(DEFAULT,_,_)] | Just (co, ty2) <- topNormaliseType fam_envs (idType case_bndr1) - = do { case_bndr2 <- newId FSLIT("nt") ty2 + = do { case_bndr2 <- newId (fsLit "nt") ty2 ; let rhs = DoneEx (Var case_bndr2 `Cast` mkSymCoercion co) env2 = extendIdSubst env case_bndr rhs ; return (env2, scrut `Cast` co, case_bndr2) } @@ -1495,9 +1498,9 @@ simplCaseBinder env0 scrut0 case_bndr0 alts improve_case_bndr env scrut case_bndr - | switchIsOn (getSwitchChecker env) NoCaseOfCase - -- See Note [no-case-of-case] - = (env, case_bndr) + -- See Note [no-case-of-case] + -- | switchIsOn (getSwitchChecker env) NoCaseOfCase + -- = (env, case_bndr) | otherwise -- Failed try; see Note [Suppressing the case binder-swap] -- not (isEvaldUnfolding (idUnfolding v)) @@ -1876,10 +1879,10 @@ mkDupableAlt env case_bndr' (con, bndrs', rhs') ; (final_bndrs', final_args) -- Note [Join point abstraction] <- if (any isId used_bndrs') then return (used_bndrs', varsToCoreExprs used_bndrs') - else do { rw_id <- newId FSLIT("w") realWorldStatePrimTy + else do { rw_id <- newId (fsLit "w") realWorldStatePrimTy ; return ([rw_id], [Var realWorldPrimId]) } - ; join_bndr <- newId FSLIT("$j") (mkPiTypes final_bndrs' rhs_ty') + ; join_bndr <- newId (fsLit "$j") (mkPiTypes final_bndrs' rhs_ty') -- Note [Funky mkPiTypes] ; let -- We make the lambdas into one-shot-lambdas. The