patch applied (ghc): More work on the simplifier's inlining
Simon Peyton Jones
simonpj at microsoft.com
Wed Dec 2 12:45:39 EST 2009
Wed Dec 2 09:42:56 PST 2009 simonpj at microsoft.com
* More work on the simplifier's inlining strategies
This patch collects a small raft of related changes
* Arrange that during
(a) rule matching and
(b) uses of exprIsConApp_maybe
we "look through" unfoldings only if they are active
in the phase. Doing this for (a) required a bit of
extra plumbing in the rule matching code, but I think
it's worth it.
One wrinkle is that even if inlining is off (in the 'gentle'
phase of simplification) during rule matching we want to
"look through" things with inlinings.
This fixes a long-standing bug, where things that were
supposed to be (say) NOINLINE, could still be poked into
* In the above cases, also check for (non-rule) loop breakers;
we never look through these. This fixes a bug that could make
the simplifier diverge (and did for Roman).
Test = simplCore/should_compile/dfun-loop
* Try harder not to choose a DFun as a loop breaker. This is
just a small adjustment in the OccurAnal scoring function
* In the scoring function in OccurAnal, look at the InlineRule
unfolding (if there is one) not the actual RHS, beause the
former is what'll be inlined.
* Make the application of any function to dictionary arguments
CONLIKE. Thus (f d1 d2) is CONLIKE.
Encapsulated in CoreUtils.isExpandableApp
Reason: see Note [Expandable overloadings] in CoreUtils
* Make case expressions seem slightly smaller in CoreUnfold.
This reverses an unexpected consequences of charging for
* Signficantly refactor the data type for Unfolding (again).
The result is much nicer.
* Add type synonym BasicTypes.CompilerPhase = Int
and use it
Many of the files touched by this patch are simply knock-on
consequences of these two refactorings.
M ./compiler/basicTypes/MkId.lhs -7 +7
M ./compiler/coreSyn/CoreFVs.lhs -1 +2
M ./compiler/coreSyn/CoreSubst.lhs -15 +26
M ./compiler/coreSyn/CoreSyn.lhs -51 +79
M ./compiler/coreSyn/CoreUnfold.lhs -91 +103
M ./compiler/coreSyn/CoreUtils.lhs -28 +61
M ./compiler/coreSyn/PprCore.lhs -20 +17
M ./compiler/deSugar/DsBinds.lhs -10 +16
M ./compiler/deSugar/DsForeign.lhs -1 +1
M ./compiler/iface/IfaceSyn.lhs -1 +1
M ./compiler/iface/MkIface.lhs -11 +14
M ./compiler/iface/TcIface.lhs -5 +2
M ./compiler/main/DynFlags.hs -2 +3
M ./compiler/main/TidyPgm.lhs -8 +8
M ./compiler/prelude/PrelRules.lhs -33 +36
M ./compiler/simplCore/OccurAnal.lhs -8 +10
M ./compiler/simplCore/SimplCore.lhs -2 +1
M ./compiler/simplCore/SimplUtils.lhs -25 +55
M ./compiler/simplCore/Simplify.lhs -23 +25
M ./compiler/specialise/Rules.lhs -104 +114
M ./compiler/specialise/Specialise.lhs -2 +3
M ./compiler/stranal/WorkWrap.lhs -1 +1
M ./compiler/vectorise/VectType.hs -2 +2
M ./compiler/vectorise/VectUtils.hs -1 +1
M ./compiler/vectorise/Vectorise.hs -1 +1
View patch online:
More information about the Cvs-ghc