From 83e19fd507e072332c0762be9295331e5773c4e9 Mon Sep 17 00:00:00 2001 From: sof Date: Sun, 19 Oct 1997 21:41:46 +0000 Subject: [PATCH 1/1] [project @ 1997-10-19 21:41:46 by sof] Refrain from doing let-to-case conversion on binders with RHS in whnf --- ghc/compiler/simplCore/SimplCore.lhs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ghc/compiler/simplCore/SimplCore.lhs b/ghc/compiler/simplCore/SimplCore.lhs index 8a122ef..d4617c9 100644 --- a/ghc/compiler/simplCore/SimplCore.lhs +++ b/ghc/compiler/simplCore/SimplCore.lhs @@ -490,9 +490,15 @@ tidyCoreExpr (Lam (UsageBinder uv) body) -- some let-to-case stuff is deferred to now). tidyCoreExpr (Let (NonRec bndr rhs) body) | willBeDemanded (getIdDemandInfo bndr) && + not rhs_is_whnf && -- Don't do it if RHS is already in WHNF typeOkForCase (idType bndr) = ASSERT( not (isPrimType (idType bndr)) ) tidyCoreExpr (Case rhs (AlgAlts [] (BindDefault bndr body))) + where + rhs_is_whnf = case mkFormSummary rhs of + VarForm -> True + ValueForm -> True + other -> False tidyCoreExpr (Let (NonRec bndr rhs) body) = tidyCoreExpr rhs `thenTM` \ rhs' -> -- 1.7.10.4