| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
| |
All uses of it are now in an IO Monad, so we don't need to use
a trace-like function.
|
|
|
|
| |
It's no longer a trace-like function.
|
| |
|
|
|
|
|
|
|
|
| |
Commit 3fcf5bdff7a22e22d7265535369cd8f867141ec1 made the output of
-ddump-rule-firings and -ddump-rule-rewrites excessively verbose.
Fixed by removing the extra blank lines and separator when the header
of dump is empty.
|
|
|
|
|
|
| |
Make -ddump-rules, -ddump-rule-firings and -ddump-rule-rewrites
behave like the other -ddump flags, by using the dumpSDoc function
instance of pprDefiniteTrace.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Silent superclass parameters solve the problem that
the superclasses of a dicionary construction can easily
turn out to be (wrongly) bottom. The problem and solution
are described in
Note [Silent superclass arguments] in TcInstDcls
I first implemented this fix (with Dimitrios) in Dec 2010, but removed
it again in Jun 2011 becuase we thought it wasn't necessary any
more. (The reason we thought it wasn't necessary is that we'd stopped
generating derived superclass constraints for *wanteds*. But we were
wrong; that didn't solve the superclass-loop problem.)
So we have to re-implement it. It's not hard. Main features:
* The IdDetails for a DFunId says how many silent arguments it has
* A DFunUnfolding describes which dictionary args are
just parameters (DFunLamArg) and which are a function to apply
to the parameters (DFunPolyArg). This adds the DFunArg type
to CoreSyn
* Consequential changes to IfaceSyn. (Binary hi file format changes
slightly.)
* TcInstDcls changes to generate the right dfuns
* CoreSubst.exprIsConApp_maybe handles the new DFunUnfolding
The thing taht is *not* done yet is to alter the vectoriser to
pass the relevant extra argument when building a PA dictionary.
|
| |
|
|
|
|
|
| |
To help with this, we now also pass DynFlags around inside the SpecM
monad.
|
|
|
|
|
| |
By using Haskell's debugIsOn rather than CPP's "#ifdef DEBUG", we
don't need to kludge things to keep the warning checker happy etc.
|
| |
|
|
|
|
|
|
|
| |
* Put the result type in the Stop continuation
* No need for the alts type in Select
The result is a modest but useful simplification
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch allows, for the first time, case expressions with an empty
list of alternatives. Max suggested the idea, and Trac #6067 showed
that it is really quite important.
So I've implemented the idea, fixing #6067. Main changes
* See Note [Empty case alternatives] in CoreSyn
* Various foldr1's become foldrs
* IfaceCase does not record the type of the alternatives.
I added IfaceECase for empty-alternative cases.
* Core Lint does not complain about empty cases
* MkCore.castBottomExpr constructs an empty-alternative case
expression (case e of ty {})
* CoreToStg converts '(case e of {})' to just 'e'
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Makes the following changes:
1. Generalises the type signatures of some functions relating to alternatives
so that the type of "variables" and "expression" is not specified
2. Puts the bulk of the alternative-filtering code into a new function filterAlts
(in CoreUtils) that can be used outside of the SimplM monad
3. Allows prepareAlts to return a null alternatives list if none are applicable -
it turns out that this case was already handled by the caller (in the simplifier).
This should result in a modest optimisation improvement in some cases.
Conflicts:
compiler/coreSyn/CoreUtils.lhs
compiler/simplCore/SimplUtils.lhs
|
|
|
|
| |
(Roman wanted this.)
|
| |
|
| |
|
|
|
|
| |
This reverts commit 601c983dd0bada6b49bdadd8f172fd4eacac4b0c.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I'm experimenting with making GHC a bit more aggressive about
a) dropping case expressions if the result is unused
Simplify.rebuildCase, CaseElim equation
b) floating case expressions inwards
FloatIn.fiExpr, AnnCase
In both cases the new behaviour is gotten with a static (debug)
flag -faggressive-primops. The extra "aggression" is to allow
discarding and floating in for side-effecting operations. See
the new, extensive Note [PrimOp can_fail and has_side_effects]
in PrimoOp.
When discarding a case with unused binders, in the lifted-type
case it's definitely ok if the scrutinee terminates; previously
we were checking exprOkForSpeculation, which is significantly
worse.
So I wanted a new function CoreUtils.exprCertainlyTerminates.
In doing this I ended up with a significant refactoring in
CoreUtils. The new structure has quite a lot of nice sharing:
exprIsCheap = exprIsCheap' isHNFApp
exprIsExpandable = exprIsCheap' isConLikeApp
exprIsHNF = exprIsHNFlike isHNFApp
exprIsConLike = exprIsHNFlike isConLikeApp
exprCertainlyTerminates = exprIsHNFlike isTerminatingApp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Two changes here
* The main change here is to enhance the FloatIn pass so that it can
float case-bindings inwards. In particular the case bindings for
array indexing.
* Also change the code in Simplify, to allow a case on array
indexing (ie can_fail is true) to be discarded altogether if its
results are unused.
Lots of new comments in PrimOp about can_fail and has_side_effects
Some refactoring to share the FloatBind data structure between
FloatIn and FloatOut
|
|
|
|
|
| |
Otherwise the RHS is utterly bogus. I also added some asserts.
Thanks to Max for pointing this out.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We had some special cases to handle things like
case (scc c (case E of alts)) of alts'
but it only worked when there was a single scc in the way. This
generalises the optimisation to handle multiple sccs and ticks, so
that we can catch most case-of-case optimisations that would normally
apply in the absence of profiling.
This fixes the example in #5363, and nofib results (with -prof
-fprof-auto) show that allocation universally goes down or stays the
same.
|
| |
|
|\ |
|
| |
| |
| |
| | |
See comments for details
|
| | |
|
| | |
|
|\ \
| |/ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This big patch implements a kind-polymorphic core for GHC. The current
implementation focuses on making sure that all kind-monomorphic programs still
work in the new core; it is not yet guaranteed that kind-polymorphic programs
(using the new -XPolyKinds flag) will work.
For more information, see http://haskell.org/haskellwiki/GHC/Kinds
|
|\ \
| |/ |
|
| |
| |
| |
| | |
Fixes some core-lint errors when compiling with profiling
|
|/
|
|
|
|
|
| |
...and make sure it is, esp in the call to findAlt in
the mighty Simplifier. Failing to check this led to
searching a bunch of DataAlts for a LitAlt Integer.
Naughty. See Trac #5603 for a case in point.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
We want to prevent the SCC from getting in the way when we have
case-of-scc-of-case, and the case-of-case would transform, so we push
the scc inside the inner case to allow the case-of-case to take
place. See comments for details.
|
|/
|
|
|
| |
We only use it for "compiler" sources, i.e. not for libraries.
Many modules have a -fno-warn-tabs kludge for now.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
User visible changes
====================
Profilng
--------
Flags renamed (the old ones are still accepted for now):
OLD NEW
--------- ------------
-auto-all -fprof-auto
-auto -fprof-exported
-caf-all -fprof-cafs
New flags:
-fprof-auto Annotates all bindings (not just top-level
ones) with SCCs
-fprof-top Annotates just top-level bindings with SCCs
-fprof-exported Annotates just exported bindings with SCCs
-fprof-no-count-entries Do not maintain entry counts when profiling
(can make profiled code go faster; useful with
heap profiling where entry counts are not used)
Cost-centre stacks have a new semantics, which should in most cases
result in more useful and intuitive profiles. If you find this not to
be the case, please let me know. This is the area where I have been
experimenting most, and the current solution is probably not the
final version, however it does address all the outstanding bugs and
seems to be better than GHC 7.2.
Stack traces
------------
+RTS -xc now gives more information. If the exception originates from
a CAF (as is common, because GHC tends to lift exceptions out to the
top-level), then the RTS walks up the stack and reports the stack in
the enclosing update frame(s).
Result: +RTS -xc is much more useful now - but you still have to
compile for profiling to get it. I've played around a little with
adding 'head []' to GHC itself, and +RTS -xc does pinpoint the problem
quite accurately.
I plan to add more facilities for stack tracing (e.g. in GHCi) in the
future.
Coverage (HPC)
--------------
* derived instances are now coloured yellow if they weren't used
* likewise record field names
* entry counts are more accurate (hpc --fun-entry-count)
* tab width is now correct (markup was previously off in source with
tabs)
Internal changes
================
In Core, the Note constructor has been replaced by
Tick (Tickish b) (Expr b)
which is used to represent all the kinds of source annotation we
support: profiling SCCs, HPC ticks, and GHCi breakpoints.
Depending on the properties of the Tickish, different transformations
apply to Tick. See CoreUtils.mkTick for details.
Tickets
=======
This commit closes the following tickets, test cases to follow:
- Close #2552: not a bug, but the behaviour is now more intuitive
(test is T2552)
- Close #680 (test is T680)
- Close #1531 (test is result001)
- Close #949 (test is T949)
- Close #2466: test case has bitrotted (doesn't compile against current
version of vector-space package)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This addresses the rare cases where the simplifier diverges
(see the above ticket). We were already counting how many simplifier
steps were taking place, but with no limit. This patch adds a limit;
at which point we halt compilation, and print out useful stats. The
stats show what is begin inlined, and how often, which points you
directly to the problem. The limit is set based on the size of the
program.
Instead of halting compilation, we could instead just inhibit
inlining, which would let compilation of the module complete. This is
a bit harder to implement, and it's likely to mean that you unrolled
the function 1143 times and then ran out of ticks; you probably don't
want to complete parsing on this highly-unrolled program.
Flags: -dsimpl-tick-factor=N. Default is 100 (percent).
A bigger number increases the allowed maximum tick count.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
compiler/iface/BuildTyCl.lhs
compiler/iface/MkIface.lhs
compiler/iface/TcIface.lhs
compiler/typecheck/TcTyClsDecls.lhs
compiler/types/Class.lhs
compiler/utils/Util.lhs
|
| |
| |
| |
| | |
failure
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
I realised that my recently-added cunning stuff about
RULES for imported Ids was simply wrong, so this patch
removes it. See Note [Rules for imported functions],
which explains it all.
This patch also does quite a bit of refactoring in
the treatment of loop breakers.
|
| |
|
|
|
|
|
|
|
|
| |
This type was mainly there to support silent superclass
parameters for dfuns, and they have gone away. So this
patch is another minor simplification.
(Interface format change; you need to make clean.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix bugs in the packing and unpacking of data
constructors with equality predicates in their types
* Remove PredCo altogether; instead, coercions between predicated
types (like (Eq a, [a]~b) => blah) are treated as if they
were precisely their underlying representation type
Eq a -> ((~) [a] b) -> blah
in this case
* Similarly, Type.coreView no longer treats equality
predciates specially.
* Implement the cast-of-coercion optimisation in
Simplify.simplCoercionF
Numerous other small bug-fixes and refactorings.
Annoyingly, OptCoercion had Windows line endings, and this
patch switches to Unix, so it looks as if every line has changed.
|
|\
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
compiler/typecheck/TcErrors.lhs
compiler/typecheck/TcSMonad.lhs
compiler/typecheck/TcType.lhs
compiler/types/TypeRep.lhs
|
| |
| |
| |
| |
| |
| | |
The point here is that a very few uses of pprTrace are
controlled by a flag like -ddump-inlinings or -ddump-rule-firings,
and we want to see that output even with -dno-debug-output
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
I'd failed to propagate the Opt_EnableRewriteRules flag properly,
which meant that -fno-enable-rewrite-rules didn't disable all
rewrites. This patch fixes it.
|
|
|
|
|
|
|
| |
The ThunkSplitting idea in WorkWrap wasn't working at all,
leading to Trac #4957. The culprit is really the simplifier
which was combining the wrong case continuations. See
Note [Fusing case continuations] in Simplify.
|