Skip to content
Snippets Groups Projects
Commit e009b4f1 authored by Joachim Breitner's avatar Joachim Breitner
Browse files

Move Common Context after CSE

We had something like
	 let $j = ...
	 in case foo of ... -> case $j a b c of ... -> case foo of
and moving the inner "case foo" into $j prevented CSE from happening
here.
(Although presumably the "let $j" could be moved inside the outer case
before CSE, to give CSE a greater scope here.)
parent 043af4d8
No related merge requests found
......@@ -52,6 +52,8 @@ findInterestingLet (Let (Rec pairs) body) =
process :: Var -> CoreExpr -> CoreExpr -> (Var, CoreExpr, CoreExpr)
process v e body
| idArity v <= 0 = (v, e, body)
-- TODO: check for non value args here. For now, ignore this let then
-- Possibly later: Check if all uses have the same type argument
| otherwise
= case contextOf v body of
OneUse cts | not (null cts) ->
......
......@@ -190,8 +190,6 @@ getCoreToDo dflags
demand_analyser = (CoreDoPasses ([
CoreDoStrictness,
CoreDoWorkerWrapper,
simpl_phase 0 ["post-worker-wrapper"] max_iter,
CoreCommonContext,
simpl_phase 0 ["post-worker-wrapper"] max_iter
]))
......@@ -293,6 +291,9 @@ getCoreToDo dflags
-- reduce the possiblility of shadowing
-- Reason: see Note [Shadowing] in SpecConstr.lhs
CoreCommonContext,
simpl_phase 0 ["post-common-context"] max_iter,
runWhen spec_constr CoreDoSpecConstr,
maybe_rule_check (Phase 0),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment