summaryrefslogtreecommitdiff
path: root/compiler/simplCore/CSE.hs
diff options
context:
space:
mode:
authorReid Barton <rwbarton@gmail.com>2017-03-01 08:23:51 -0500
committerReid Barton <rwbarton@gmail.com>2017-03-01 08:26:45 -0500
commit85c486a16bff96281c53baf8b385a39f259d39be (patch)
tree61a5382a878dfc9a909bdd2146effd41167d96b3 /compiler/simplCore/CSE.hs
parent701256df88c61a2eee4cf00a59e61ef76a57b4b4 (diff)
downloadhaskell-wip/rwbarton-D1259.tar.gz
Diffstat (limited to 'compiler/simplCore/CSE.hs')
-rw-r--r--compiler/simplCore/CSE.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs
index b8e26b593e..6603abf14a 100644
--- a/compiler/simplCore/CSE.hs
+++ b/compiler/simplCore/CSE.hs
@@ -294,11 +294,14 @@ cseProgram binds = snd (mapAccumL (cseBind True) emptyCSEnv binds)
cseBind :: Bool -> CSEnv -> CoreBind -> (CSEnv, CoreBind)
cseBind toplevel env (NonRec b e)
- = (env2, NonRec b2 e1)
+ = (env2, NonRec b2 e2)
where
e1 = tryForCSE toplevel env e
(env1, b1) = addBinder env b
(env2, b2) = addBinding env1 b b1 e1
+ e2 -- See Note [Take care with literal strings]
+ | toplevel && exprIsLiteralString e = e
+ | otherwise = e1
cseBind _ env (Rec [(in_id, rhs)])
| noCSE in_id
@@ -402,9 +405,7 @@ the original RHS unmodified. This produces:
-}
tryForCSE :: Bool -> CSEnv -> InExpr -> OutExpr
-tryForCSE toplevel env expr
- | toplevel && exprIsLiteralString expr = expr
- -- See Note [Take care with literal strings]
+tryForCSE _toplevel env expr
| Just e <- lookupCSEnv env expr'' = mkTicks ticks e
| otherwise = expr'
-- The varToCoreExpr is needed if we have