summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/coreSyn/CoreUtils.lhs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/coreSyn/CoreUtils.lhs b/compiler/coreSyn/CoreUtils.lhs
index 601165e0f3..6bcf3fbde4 100644
--- a/compiler/coreSyn/CoreUtils.lhs
+++ b/compiler/coreSyn/CoreUtils.lhs
@@ -211,6 +211,15 @@ mkCoerce co expr
-- annotation if possible.
mkTick :: Tickish Id -> CoreExpr -> CoreExpr
+mkTick t (Var x)
+ | isFunTy (idType x) = Tick t (Var x)
+ | otherwise
+ = if tickishCounts t
+ then if tickishScoped t && tickishCanSplit t
+ then Tick (mkNoScope t) (Var x)
+ else Tick t (Var x)
+ else Var x
+
mkTick t (Cast e co)
= Cast (mkTick t e) co -- Move tick inside cast