| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ensure that division wrappers are INLINE
* make div/mod/divMod call quot/rem/quotRem (same code)
* this ensures that the quotRemWordN# primitive is used to implement
divMod (it wasn't the case for sized Words)
* make first argument strict for Natural and Integer (similarly to other
numeric types)
(cherry picked from commit 737b0ae194ca33f9bea9a150dada0c933fd75d4d)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have a function in #20510 that is small enough to get a stable unfolding in WW:
```hs
small :: Int -> Int
small x = go 0 x
where
go z 0 = z * x
go z y = go (z+y) (y-1)
```
But it appears we failed to use the WW'd RHS as the stable unfolding. As a result,
inlining `small` would expose the non-WW'd version of `go`. That appears to regress
badly in #19727 which is a bit too large to extract a reproducer from that is
guaranteed to reproduce across GHC versions.
The solution is to simply update the unfolding in `certainlyWillInline` with the
WW'd RHS.
Fixes #20510.
(cherry picked from commit 925c47b46529d202190f18bd653a6945caa51823)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Note [Matching lets] in GHC.Core.Rules claims the following:
> We use GHC.Core.Subst.substBind to freshen the binding, using an
> in-scope set that is the original in-scope variables plus the
> rs_bndrs (currently floated let-bindings).
However, previously the implementation didn't actually do extend the
in-scope set with rs_bndrs. This appears to be a regression which was
introduced by 4ff4d434e9a90623afce00b43e2a5a1ccbdb4c05.
Moreover, the originally reasoning was subtly wrong: we must rather use
the in-scope set from rv_lcl, extended with rs_bndrs, not that of
`rv_fltR`
Fixes #21122.
|
|
|
|
| |
This reverts commit 8bbdba450980c2b0054e19ae737eeaa3cfdb452d.
|
|
|
|
|
|
|
|
| |
Metric Decrease:
T9872c
Metric Increase:
T12545
T18223
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Note [Matching lets] in GHC.Core.Rules claims the following:
> We use GHC.Core.Subst.substBind to freshen the binding, using an
> in-scope set that is the original in-scope variables plus the
> rs_bndrs (currently floated let-bindings).
However, previously the implementation didn't actually do extend the
in-scope set with rs_bndrs. This appears to be a regression which was
introduced by 4ff4d434e9a90623afce00b43e2a5a1ccbdb4c05. Reintroduce
`rs_bndrs` into the in-scope set, ensuring that let-binders cannot
shadow one another due to rule rewrites.
Fixes #21122.
(cherry picked from commit 0f7dc6701cfb6be59deb8601da8da000fe70263f)
|
|
|
|
|
|
|
|
| |
substExpr warns if it finds a LocalId that isn't in the in-scope set.
This patch extends the in-scope set to silence the warnings. (It has
no effect on behaviour.)
(cherry picked from commit 25ca0b5aef54281d161288d9d951a6325d0ab53f)
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes #19790 by making the rule matcher do on-the-fly
eta reduction. See Note [Eta reduction the target] in GHC.Core.Rules
I found I also had to careful about casts when matching; see
Note [Casts in the target] and Note [Casts in the template]
Lots more comments and Notes in the rule matcher
(cherry picked from commit 590a2918d815edd184a1665e361640a29674cbf3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was a subtle error in the in-scope set during RULE matching,
which led to #20200 (not the original report, but the reports of
failures following an initial bug-fix commit).
This patch fixes the problem, and simplifies the code a bit.
In pariticular there was a very mysterious and ad-hoc in-scope set
extension in rnMatchBndr2, which is now moved to the right place,
namely in the Let case of match, where we do the floating.
I don't have a small repro case, alas.
(cherry picked from commit 4ff4d434e9a90623afce00b43e2a5a1ccbdb4c05)
|
|
|
|
|
|
|
|
|
|
|
| |
This is the right thing to do, easy to do, and fixes
a second not-in-scope crash in #20200 (see !6302)
The problem occurs in the findBest test, which compares
two RULES.
Repro case in simplCore/should_compile/T20200a
(cherry picked from commit 7f217429a44747e418af6549606fcbcce005ba2e)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As #20200 showed, there was a call to lookupIdSubst during RULE
matching, where the variable being looked up wasn't in the InScopeSet.
This patch fixes the problem at source, by dealing separately with
nested and non-nested binders.
As a result we can change the trace call in lookupIdSubst to a
proper panic -- if it happens, we really want to know.
(cherry picked from commit 149bce42fc324863c5da8c98b4991358b5ec4617)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the call to prepareBinding (in simplLazyBind), I had failed to
extend the in-scope set with the binders from body_floats1. As as
result, when eta-expanding deep inside prepareBinding we made up
an eta-binder that shadowed a variable free in body1. Yikes.
It's hard to trigger this bug. It showed up when I was working
on !5658, and I started using the in-scope set for eta-expansion,
rather than taking free variables afresh. But even then it only
showed up when compiling a module in Haddock
utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
Sadly Haddock is compiled without Core Lint, so we ultimately got
a seg-fault. Lint nailed it fast once I realised that it was off.
There is some other tiny refactoring in this patch.
(cherry picked from commit 91eb18570fae4e1982e660f6dcb4f7b69de58cf2)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the eta-expansion would return lambdas interspersed with
casts; now the cast is just pushed to the outside: #20153.
This actually simplifies the code.
I also improved mkNthCo to account for SymCo, so that
mkNthCo n (SymCo (TyConAppCo tc cos))
would work well.
(cherry picked from commit a199d653a621fdc96e811c8ae076414965dc25dc)
|
|
|
|
| |
A partial backport of 299b7436d140a5f43ce75a2a1d022572f23fb3f9.
|
| |
|
|
|
|
|
|
| |
The underlying bug was fixed by b8d98827, see MR !2477
(cherry picked from commit 48b0f17acff0c35df2d3b63dd6b624832cd54852)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
See Note [Equality on FunTys] in TyCoRep.
Close #17675.
Close #17655, about documentation improvements included in
this patch.
Close #19677, about a further mistake around FunTy.
test cases: typecheck/should_compile/T19677
(cherry picked from commit b8d98827d73fd3e49867cab09f9440fc8c311bfe)
|
|
|
|
|
|
|
|
| |
When the input literal was larger than 32-bit it would crash in a
compiler with assertion enabled because it was creating an out-of-bound
word-sized literal (32-bit).
(cherry-picked from 4c86df25d3)
|
|
|
|
|
|
|
|
|
| |
GHC is bignum backend agnostic and shouldn't report this information as
in the future ghc-bignum will be reinstallable potentially with a
different backend that GHC is unaware of. Moreover as #20495 shows the
returned information may be wrong currently.
(cherry picked from commit 79a26df1475505ee1e87eb7fda04e5fefdf6aa4c)
|
|
|
|
| |
As requested in #20580.
|
|
|
|
| |
(cherry picked from commit 2929850f0139778c579fc7144831c88e11353a9b)
|
| |
|
| |
|
| |
|
|
|
|
| |
Scripts taken from autoconf c179db1b6f2ae484bfca1e9f8bae273e3319fa7d
|
| |
|
| |
|
| |
|
|
|
|
| |
Due to #20874.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, surrounding a head expression with a TH splice would defeat
`tcInferAppHead_maybe`, preventing some expressions from typechecking that
used to typecheck in previous GHC versions (see #21038 for examples). This is
simple enough to fix: just look through `HsSpliceE`s in `tcInferAppHead_maybe`.
I've added some additional prose to `Note [Application chains and heads]` in
`GHC.Tc.Gen.App` to accompany this change.
Fixes #21038.
(cherry picked from commit fd9981e347144ce69f4747bd635789f25b673f93)
|
|
|
|
|
|
|
|
|
|
| |
There were situations where we were using debugLevel == 0 as a proxy for
whether to retain source notes but -finfo-table-map also enables and
needs source notes so we should act consistently in both cases.
Ticket #20847
(cherry picked from commit 1316f7dadf0f538f09f8b97629c7e5f6f868266d)
|
|
|
|
|
|
| |
Related CLC proposal is here: https://github.com/haskell/core-libraries-committee/issues/30
(cherry picked from commit 4bd52410d03f851f69f85d43855358733d5ceb6d)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are some situations where we end up with no source notes in useful
positions in an expression. In this case we currently fail to provide
any source information about where an expression came from.
This patch improves the initial estimate by using the position from the
top-binder as the guess for the location of the whole inner expression.
It provides quite a course estimate but it's better than nothing.
Ticket #20847
(cherry picked from commit a98e55e767764cb810833492b898d1e75f93fd77)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the master branch !5478 fixed #19460.
As #19460 has highest priority and didn't get fixed in
the ghc-92 branch, backport MR !5478 to GHC 9.2.
Add test T19460.
MR !5478: Always generate ModDetails from ModIface
This vastly reduces memory usage when compiling with `--make` mode, from
about 900M when compiling Cabal to about 300M.
As a matter of uniformity, it also ensures that reading from an
interface performs the same as using the in-memory cache. We can also
delete all the horrible knot-tying in updateIdInfos.
Goes some way to fixing #13586
Accept new output of tests fixing some bugs along the way
-------------------------
Metric Decrease:
T12545
-------------------------
(cherry picked from commit 14e53b1bbe611b46b82f8a917cab49cf489151a5)
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
As noted in #20707, the validate jobs which we previously used lacked
profiling support.
Also clean up some variable definitions.
Fixes #20707.
(cherry picked from commit 96b3899efc578f467037f6282551b7aae510081a)
|
|
|
|
| |
This reverts commit 85dbf1cac30cbff5c4f296a792860f18ff30572e.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Fixed typo and outdated link in Data.Foldable
- The Traversable docs got overhauled, leaving a stale link in Foldable to a
section that got replaced. Gave the new section an anchor and updated the
link.
- Merged partiality warnings recently added in HEAD
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows us to remove the dependency on parsec and hence transitively
on text.
Also added some simple unit tests for the parser and fixed two small
issues in the documentation.
Fixes #21033
(cherry picked from commit 84ab0153a3527e7bd8b627ca559d782064af3c80)
|
|
|
|
| |
(cherry picked from commit d2cce4532947367a5305783bd3e93c1858cded2e)
|
|
|
|
| |
(cherry picked from commit e59446c6a682587c21424e5830f305ab2f8f8cfa)
|
|
|
|
|
|
|
| |
Compare expressions and types when comparing `CmmLoad`s.
Fixes #21016
(cherry picked from commit d1ef62889f0988317ce0eb495130021f27765689)
|
|
|
|
|
|
|
|
| |
Previously the documentation was subtly incorrect regarding the bounds
of the operation. Fix this and add a test asserting that a zero-length
operation is in fact a no-op.
(cherry picked from commit 8c18feba88aaa20b75b82c3fee7e8f742299461e)
|
|
|
|
|
|
|
| |
This allows us to produce valid code for indexWord8ArrayAs*# on
platforms that lack unaligned memory access.
(cherry picked from commit 1cf9616a379a084daaa4d7219ebb75aa3e358e05)
|