From f5887bccdb537a011953576c4d106a37d371b69b Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 16 May 2007 10:05:44 +0000 Subject: [PATCH] Avoid some unnecessary ticks in debugging mode --- compiler/deSugar/Coverage.lhs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/deSugar/Coverage.lhs b/compiler/deSugar/Coverage.lhs index 6f8d35f..a8e774e 100644 --- a/compiler/deSugar/Coverage.lhs +++ b/compiler/deSugar/Coverage.lhs @@ -177,10 +177,13 @@ addTickLHsBind (VarBind var_id var_rhs) = do -} addTickLHsBind other = return other --- add a tick to the expression no matter what it is +-- Add a tick to the expression no matter what it is. There is one exception: +-- for the debugger, if the expression is a 'let', then we don't want to add +-- a tick here because there will definititely be a tick on the body anyway. addTickLHsExprAlways :: LHsExpr Id -> TM (LHsExpr Id) -addTickLHsExprAlways (L pos e0) = do - allocTickBox (ExpBox False) pos $ addTickHsExpr e0 +addTickLHsExprAlways (L pos e0) + | not opt_Hpc, HsLet _ _ <- e0 = addTickLHsExprNever (L pos e0) + | otherwise = allocTickBox (ExpBox False) pos $ addTickHsExpr e0 addTickLHsExprNeverOrAlways :: LHsExpr Id -> TM (LHsExpr Id) addTickLHsExprNeverOrAlways e -- 1.7.10.4