| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
Update submodule: haddock
|
|
|
|
| |
Update haddock submodule
|
|
|
|
|
|
| |
It sometimes happened that occAnal would remove bindings
as dead code by relying on bindings to be in dependency
order. The fix was contributed by SPJ.
|
|
|
|
|
|
| |
incomplete-uni-patterns and incomplete-record-updates will be in -Wall at a
future date, so prepare for that by disabling those warnings on files that
trigger them.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Transformed the type aliases `InterestingCxt`, `InsideLam` and `OneBranch`
into data types.
* Added Semigroup and Monoid instances for use in orOccInfo in OccurAnal.hs
* Simplified some usage sites by using pattern matching instead of boolean algebra.
Metric Increase:
T12150
This increase was on a Mac-build of exactly 1%. This commit does *not* re-intruduce
the asymptotic memory usage described in T12150.
|
|
|
|
|
| |
This moves all URL references to Trac tickets to their corresponding
GitLab counterparts.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch disables the binder-swap transformation in the
(relatively rare) case when the scrutinee is a GlobalId.
Reason: we are getting Lint errors so that GHC doesn't
even validate. Trac #16346.
This is NOT the final solution -- it's just a stop-gap
to get us running again.
The final solution is in Trac #16296
|
| |
|
|
|
|
| |
Also use 'id'
|
|
|
|
|
|
|
|
| |
For years we have been marking CoVars as dead, becuase we
don't gather occurrence info from types. This is obviously
wrong and caused Trac #15695.
See Note [Do not mark CoVars as dead] in OccurAnal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds foldl' to GhcPrelude and changes must occurences
of foldl to foldl'. This leads to better performance especially
for quick builds where GHC does not perform strictness analysis.
It does change strictness behaviour when we use foldl' to turn
a argument list into function applications. But this is only a
drawback if code looks ONLY at the last argument but not at the first.
And as the benchmarks show leads to fewer allocations in practice
at O2.
Compiler performance for Nofib:
O2 Allocations:
-1 s.d. ----- -0.0%
+1 s.d. ----- -0.0%
Average ----- -0.0%
O2 Compile Time:
-1 s.d. ----- -2.8%
+1 s.d. ----- +1.3%
Average ----- -0.8%
O0 Allocations:
-1 s.d. ----- -0.2%
+1 s.d. ----- -0.1%
Average ----- -0.2%
Test Plan: ci
Reviewers: goldfire, bgamari, simonmar, tdammers, monoidal
Reviewed By: bgamari, monoidal
Subscribers: tdammers, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4929
|
|
|
|
|
| |
... plus, reorder equations in toIfaceVar to improve
legibility. No change in behaviour.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Back in 1999 I put this ad-hoc code in the Case-handling
code for occAnal:
occAnal env (Case scrut bndr ty alts)
= ...
-- Note [Case binder usage]
-- ~~~~~~~~~~~~~~~~~~~~~~~~
-- The case binder gets a usage of either "many" or "dead", never "one".
-- Reason: we like to inline single occurrences, to eliminate a binding,
-- but inlining a case binder *doesn't* eliminate a binding.
-- We *don't* want to transform
-- case x of w { (p,q) -> f w }
-- into
-- case x of w { (p,q) -> f (p,q) }
tag_case_bndr usage bndr
= (usage', setIdOccInfo bndr final_occ_info)
where
occ_info = lookupDetails usage bndr
usage' = usage `delDetails` bndr
final_occ_info = case occ_info of IAmDead -> IAmDead
_ -> noOccInfo
But the comment looks wrong -- the bad inlining will not happen -- and
I think it relates to some long-ago version of the simplifier.
So I simply removed the special case, which gives more accurate
occurrence-info to the case binder. Interestingly I got a slight
improvement in nofib binary sizes.
--------------------------------------------------------------------------------
Program Size Allocs Runtime Elapsed TotalMem
--------------------------------------------------------------------------------
cacheprof -0.1% +0.2% -0.7% -1.2% +8.6%
--------------------------------------------------------------------------------
Min -0.2% 0.0% -14.5% -30.5% 0.0%
Max -0.1% +0.2% +10.0% +10.0% +25.0%
Geometric Mean -0.2% +0.0% -1.9% -5.4% +0.3%
I have no idea if the improvement in runtime is real. I did look at the
tiny increase in allocation for cacheprof and concluded that it was
unimportant (I forget the details).
Also the more accurate occ-info for the case binder meant that some
inlining happens in one pass that previously took successive passes
for the test dependent/should_compile/dynamic-paper (which has a
known Russel-paradox infinite loop in the simplifier).
In short, a small win: less ad-hoc complexity and slightly smaller
binaries.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Poor DPH and its vectoriser have long been languishing; sadly it seems there is
little chance that the effort will be rekindled. Every few years we discuss
what to do with this mass of code and at least once we have agreed that it
should be archived on a branch and removed from `master`. Here we do just that,
eliminating heaps of dead code in the process.
Here we drop the ParallelArrays extension, the vectoriser, and the `vector` and
`primitive` submodules.
Test Plan: Validate
Reviewers: simonpj, simonmar, hvr, goldfire, alanz
Reviewed By: simonmar
Subscribers: goldfire, rwbarton, thomie, mpickering, carter
Differential Revision: https://phabricator.haskell.org/D4761
|
|
|
|
|
|
|
|
|
| |
* (+++) --> andUDs
* combineAltsUsageDetails --> orUDs
* combineUsageDetailsList --> andUDsList
* Change some andUDsList to a fold for efficiency
No change in behaviour
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch moves the "ok_unfolding" test
from CoreOpt.joinPointBinding_maybe
to OccurAnal.decideJoinPointHood
Previously the occurrence analyser was deciding to make
something a join point, but the simplifier was reversing
that decision, which made the decision about /other/ bindings
invalid.
Fixes Trac #14650.
|
|
|
|
|
|
| |
The new comment explains why this warning can
legitimately fire, so I've removed it entirely.
Lint will cath any bad cases.
|
|
|
|
| |
...provked by #14620
|
|
|
|
|
|
|
|
|
| |
This patch fixes #14567. The idea is simple: if a function
is marked NOINLINE then it makes a great candidate for a loop
breaker.
Implementation is easy too, but it needs a little extra plubming,
notably the occ_unf_act field in OccEnv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This switches the compiler/ component to get compiled with
-XNoImplicitPrelude and a `import GhcPrelude` is inserted in all
modules.
This is motivated by the upcoming "Prelude" re-export of
`Semigroup((<>))` which would cause lots of name clashes in every
modulewhich imports also `Outputable`
Reviewers: austin, goldfire, bgamari, alanz, simonmar
Reviewed By: bgamari
Subscribers: goldfire, rwbarton, thomie, mpickering, bgamari
Differential Revision: https://phabricator.haskell.org/D3989
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In general ticks are problematic for join point analysis as described
in #14242. However, source notes are intended to be a best-effort
annotation which shouldn't interfere with optimization. Special-case
these to ensure that tail-call information is still correct, even in the
presence of source note
ticks.
Test Plan: Validate
Reviewers: simonpj, austin
Reviewed By: simonpj
Subscribers: rwbarton, thomie
GHC Trac Issues: #14242
Differential Revision: https://phabricator.haskell.org/D3978
|
| |
|
|
|
|
|
|
| |
This minor change fixes Trac #14137.
It is described in Note [Join point RHSs] in OccurAnal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch changes isExpandableApp and isWorkFreeApp to respond
False to bottoming applications. I found that if we had
x = undefined <dict-expr>
then prepareRhs was ANF'ing it to
d = <dict-expr>
x = undefined d
which is stupid (no gain); and worse it made the simplifier iterate
indefinitely. It showed up when I started marking 'x' as a bottoming
Id more aggresssively than before; but it's been a lurking bug for
ages.
It was convenient to make isWorkFreeApp also return False for
bottoming applications, and I see no reason not to do so.
That leaves isCheapApp. It currently replies True to bottoming
applications, but I don't see why that's good.. Something to try
later.
|
| |
|
|
|
|
|
|
|
| |
No need to mark the binders with markNonTailCalled, as they already have been
marked as such in rhs_udss' via adjust.
Differential Revision: https://phabricator.haskell.org/D3810
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While investigating #12545, I discovered several places in the code
that performed length-checks like so:
```
length ts == 4
```
This is not ideal, since the length of `ts` could be much longer than 4,
and we'd be doing way more work than necessary! There are already a slew
of helper functions in `Util` such as `lengthIs` that are designed to do
this efficiently, so I found every place where they ought to be used and
did just that. I also defined a couple more utility functions for list
length that were common patterns (e.g., `ltLength`).
Test Plan: ./validate
Reviewers: austin, hvr, goldfire, bgamari, simonmar
Reviewed By: bgamari, simonmar
Subscribers: goldfire, rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3622
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This refactoring makes it more obvious when we are constructing
a Node for the digraph rather than a less useful 3-tuple.
Reviewers: austin, goldfire, bgamari, simonmar, dfeuer
Reviewed By: dfeuer
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3414
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One commented out tracing function didn't type check and also show the
scores of loop breaker nodes.
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3371
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, bgamari, dfeuer
Reviewed By: bgamari, dfeuer
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3360
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The fundamental problem with `type UniqSet = UniqFM` is that `UniqSet`
has a key invariant `UniqFM` does not. For example, `fmap` over
`UniqSet` will generally produce nonsense.
* Upgrade `UniqSet` from a type synonym to a newtype.
* Remove unused and shady `extendVarSet_C` and `addOneToUniqSet_C`.
* Use cached unique in `tyConsOfType` by replacing
`unitNameEnv (tyConName tc) tc` with `unitUniqSet tc`.
Reviewers: austin, hvr, goldfire, simonmar, niteria, bgamari
Reviewed By: niteria
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3146
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When we have
join j x y = rhs in ...
we know that the lambdas for 'x' and 'y' are one-shot.
Let's mark them as such!
This doesn't fix a specific bug, but it feels right to me.
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: lukemaurer, thomie
Differential Revision: https://phabricator.haskell.org/D3196
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When determining whether an expression is used saturatedly, count the
number of value arguments that the occurrence analyser sees, and add
the number of one-shot arguments that we know (from the strictness
analyser) are passed from the context.
perf results suggest no noticable change in allocations, reduction of
code sizes, and performance regression possibliy due to loss of join
points.
Test Plan: perf.haskell.org
Reviewers: simonpj, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3089
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- OccurAnal: When checking tail calls, count rule's LHS args, not bndrs
Pretty obvious error in retrospect:
```
let $sj = \y ys -> ...
{-# RULES "SC:j" forall y ys. j (y:ys) = $sj y ys #-}
j = \xs -> ...
in ...
```
A jump on the RHS of a rule for a join point is only okay if the rule's
LHS is
saturated - in this case, since the LHS is j (y:ys) and j takes one
argument,
both j and $sj can become join points. See Note [Rules and join points]
in
OccurAnal. By mistake, OccAnal was counting the rule's binders (y and
ys) rather
than the args in its LHS, so $sj wasn't being made a join point.
- Don't zap tail calls in unfoldings
This was causing T7796 to squeal about join points not being
rediscovered.
Reviewers: bgamari, austin
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3080
|
|
|
|
|
|
|
| |
This fixes #13227. It remains to be seen what the performance impacts
are. Pushing as a branch to get perf.haskell.org answer that for us.
Differential Revision: https://phabricator.haskell.org/D3067
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This major patch implements Join Points, as described in
https://ghc.haskell.org/trac/ghc/wiki/SequentCore. You have
to read that page, and especially the paper it links to, to
understand what's going on; but it is very cool.
It's Luke Maurer's work, but done in close collaboration with Simon PJ.
This Phab is a squash-merge of wip/join-points branch of
http://github.com/lukemaurer/ghc. There are many, many interdependent
changes.
Reviewers: goldfire, mpickering, bgamari, simonmar, dfeuer, austin
Subscribers: simonpj, dfeuer, mpickering, Mikolaj, thomie
Differential Revision: https://phabricator.haskell.org/D2853
|
| |
|
| |
|