| ... |
... |
@@ -220,11 +220,15 @@ getCoreToDo dflags hpt_rule_base extra_vars |
|
220
|
220
|
-- minimum effort please
|
|
221
|
221
|
-- Specialisation is best done before full laziness
|
|
222
|
222
|
-- so that overloaded functions have all their dictionary lambdas manifest
|
|
223
|
|
- runWhen (do_specialise || do_co_opt) $
|
|
|
223
|
+ runWhen do_specialise $
|
|
224
|
224
|
CoreDoPasses [ simpl_gently
|
|
225
|
|
- , runWhen do_co_opt CoreOptCoercion
|
|
226
|
225
|
, runWhen do_specialise CoreDoSpecialising ],
|
|
227
|
226
|
|
|
|
227
|
+ -- Optimise coercions
|
|
|
228
|
+ -- With -O do this after one run of the Simplifier.
|
|
|
229
|
+ -- Without -O, just take what the desugarer produced
|
|
|
230
|
+ runWhen do_co_opt CoreOptCoercion,
|
|
|
231
|
+
|
|
228
|
232
|
if full_laziness then
|
|
229
|
233
|
CoreDoFloatOutwards $ FloatOutSwitches
|
|
230
|
234
|
{ floatOutLambdas = Just 0
|
| ... |
... |
@@ -257,7 +261,8 @@ getCoreToDo dflags hpt_rule_base extra_vars |
|
257
|
261
|
-- Run the simplifier phases 2,1,0 to allow rewrite rules to fire
|
|
258
|
262
|
runWhen do_simpl3
|
|
259
|
263
|
(CoreDoPasses $ [ simpl_phase (Phase phase) "main" max_iter
|
|
260
|
|
- | phase <- [phases, phases-1 .. 1] ] ++
|
|
|
264
|
+ | phase <- [phases, phases-1 .. 1] ]
|
|
|
265
|
+ ++
|
|
261
|
266
|
[ simpl_phase (Phase 0) "main" (max max_iter 3) ]),
|
|
262
|
267
|
-- Phase 0: allow all Ids to be inlined now
|
|
263
|
268
|
-- This gets foldr inlined before strictness analysis
|
| ... |
... |
@@ -310,6 +315,8 @@ getCoreToDo dflags hpt_rule_base extra_vars |
|
310
|
315
|
|
|
311
|
316
|
runWhen do_float_in CoreDoFloatInwards,
|
|
312
|
317
|
|
|
|
318
|
+ --------- Final run of the Simplifier ---------------
|
|
|
319
|
+ -- This runs even with -O0
|
|
313
|
320
|
simplify "final", -- Final tidy-up
|
|
314
|
321
|
|
|
315
|
322
|
maybe_rule_check FinalPhase,
|