Take vectorisation declarations into account during the initial occurrence analysis (right after desugaring).
Don't discard usage info from coercion bindings!
This BIG PATCH contains most of the work for the New Coercion Representation See the paper "Practical aspects of evidence based compilation in System FC" * Coercion becomes a data type, distinct from Type * Coercions become value-level things, rather than type-level things, (although the value is zero bits wide, like the State token) A consequence is that a coerion abstraction increases the arity by 1 (just like a dictionary abstraction) * There is a new constructor in CoreExpr, namely Coercion, to inject coercions into terms
Really zap case-binder occurrence info: solves #5028 Converted from a darcs patch from Max Bolingbroke: Fri Apr 1 11:39:49 BST 2011 Max Bolingbroke <batterseapower@hotmail.com> * Really zap case-binder occurrence info: solves #5028
Fix Trac #5028: zap occ info when doing the binder swap This fixes the Lint error, but still risks leaving stupid let { x=y } bindings in the code. But no time to fix that today. (Leave the ticket open for that reason.)
Make the occurrence analyser track preInlineUnconditionally This fixes a somewhat obscure situation in which an over-optimistic use of "occurs once" led to an infinite sequence of simplifier iterations. Se Note [Cascading inlines] for the details. This showed up when compiling rather large DPH programs, which run lots of iterations of the simplifier, which in turn made compilation take much longer than necessary.
Occurrence analyser takes account of the phase when handing RULES See Note [Finding rule RHS free vars] This should make Roman happy.
Make the occurrence analyser deal correctly with RULES for imported Ids This patch fixes a long-standing lurking bug, but it surfaced when I was adding specialisation for imported Ids. See Note [ImpRuleUsage], which explains the issue. The solution seems more complicated than the problem really deserves, but I could not think of a simpler way, so I just bit the bullet and wrote the code. Improvements welcome.
Implement INLINABLE pragma Implements Trac #4299. Documentation to come.
Super-monster patch implementing the new typechecker -- at last This major patch implements the new OutsideIn constraint solving algorithm in the typecheker, following our JFP paper "Modular type inference with local assumptions". Done with major help from Dimitrios Vytiniotis and Brent Yorgey.
Add Outputable instance for OccEncl
Be a bit less aggressive in mark-many inside a cast
Use addToUFM_Acc where appropriate This way of extending a UniqFM has existed for some time, but we weren't really using it. addToUFM_Acc :: Uniquable key => (elt -> elts -> elts) -- Add to existing -> (elt -> elts) -- New element -> UniqFM elts -- old -> key -> elt -- new -> UniqFM elts -- result
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. See SimplUtils.activeUnfInRule. This fixes a long-standing bug, where things that were supposed to be (say) NOINLINE, could still be poked into via exprIsConApp_maybe. * 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 alternatives. Refactorings ~~~~~~~~~~~~ * 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.
Implement -fexpose-all-unfoldings, and fix a non-termination bug The -fexpose-all-unfoldings flag arranges to put unfoldings for *everything* in the interface file. Of course, this makes the file a lot bigger, but it also makes it complete, and that's great for supercompilation; or indeed any whole-program work. Consequences: * Interface files need to record loop-breaker-hood. (Previously, loop breakers were never exposed, so that info wasn't necessary.) Hence a small interface file format change. * When inlining, must check loop-breaker-hood. (Previously, loop breakers didn't have an unfolding at all, so no need to check.) * Ditto in exprIsConApp_maybe. Roman actually tripped this bug, because a DFun, which had an unfolding, was also a loop breaker * TidyPgm.tidyIdInfo must be careful to preserve loop-breaker-hood So Id.idUnfolding checks for loop-breaker-hood and returns NoUnfolding if so. When you want the unfolding regardless of loop-breaker-hood, use Id.realIdUnfolding. I have not documented the flag yet, because it's experimental. Nor have I tested it thoroughly. But with the flag off (the normal case) everything should work.
Re-implement the binder-swap stuff in OccurAnal This is a pretty big patch, but it has a very local effect. It affects only the binder-swap mechanism in OccurAnal, which was not working well becuase it's more subtle than I'd realised (See Note [getProxies is subtle]). I think this does a much better job.
Try harder not to make DFuns into loop breakers See Note [DFuns should not be loop breakers]
Comments only
Comments in OccurAnal
Another refactoring on the shape of an Unfolding I found that a compulsory unfolding was getting dropped on the floor, so I took that as a hint to tidy up the data type so that it won't happen again. No big change in functionality.