summaryrefslogtreecommitdiff
path: root/compiler/GHC
Commit message (Collapse)AuthorAgeFilesLines
* Remove wired-in names hs-boot check bypass (#19855)Sylvain Henry2021-05-191-3/+0
| | | | The check bypass is no longer necessary and the check would have avoided #19638.
* constant folding: Make shiftRule for Word8/16/32# types return correct typeMatthew Pickering2021-05-191-6/+6
| | | | Fixes #19851
* Make setBndrsDemandInfo work with only type variablesMatthew Pickering2021-05-191-4/+4
| | | | | | Fixes #19849 Co-authored-by: Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io>
* PPC NCG: Fix unsigned compare with 16-bit constantsPeter Trommler2021-05-191-1/+2
| | | | Fixes #19852 and #19609
* driver: check if clang is the assembler when passing clang specific ↵Adam Sandberg Ericsson2021-05-193-15/+34
| | | | | | | arguments (#19827) Previously we assumed that the assembler was the same as the c compiler, but we allow setting them to different programs with -pgmc and -pgma.
* Changes to HsRecField'Shayne Fletcher2021-05-1922-154/+156
|
* Cmm: fix sinking after suspendThreadSylvain Henry2021-05-199-21/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose a safe call: myCall(x,y,z) It is lowered into three unsafe calls in Cmm: r = suspendThread(...); myCall(x,y,z); resumeThread(r); Consider the following situation for myCall arguments: x = Sp[..] -- stack y = Hp[..] -- heap z = R1 -- global register r = suspendThread(...); myCall(x,y,z); resumeThread(r); The sink pass assumes that unsafe calls clobber memory (heap and stack), hence x and y assignments are not sunk after `suspendThread`. The sink pass also correctly handles global register clobbering for all unsafe calls, except `suspendThread`! `suspendThread` is special because it releases the capability the thread is running on. Hence the sink pass must also take into account global registers that are mapped into memory (in the capability). In the example above, we could get: r = suspendThread(...); z = R1 myCall(x,y,z); resumeThread(r); But this transformation isn't valid if R1 is (BaseReg->rR1) as BaseReg is invalid between suspendThread and resumeThread. This caused argument corruption at least with the C backend ("unregisterised") in #19237. Fix #19237
* CPR: Detect constructed products in `runRW#` apps (#19822)Sebastian Graf2021-05-193-26/+54
| | | | | | | | | | | | | | | | | | | | | In #19822, we realised that the Simplifier's new habit of floating cases into `runRW#` continuations inhibits CPR analysis from giving key functions of `text` the CPR property, such as `singleton`. This patch fixes that by anticipating part of !5667 (Nested CPR) to give `runRW#` the proper CPR transformer it now deserves: Namely, `runRW# (\s -> e)` should have the CPR property iff `e` has it. The details are in `Note [Simplification of runRW#]` in GHC.CoreToStg.Prep. The output of T18086 changed a bit: `panic` (which calls `runRW#`) now has `botCpr`. As outlined in Note [Bottom CPR iff Dead-Ending Divergence], that's OK. Fixes #19822. Metric Decrease: T9872d
* EPA: Remove duplicate annotations from HsDataDefnAlan Zimmerman2021-05-194-17/+14
| | | | | | | | They are repeated in the surrounding DataDecl and FamEqn. Updates haddock submodule Closes #19834
* Tidy: Ignore rules (more) when -fomit-interface-pragmas is onMatthew Pickering2021-05-191-1/+8
| | | | | | | | | | | Before this commit, the RHS of a rule would expose additional definitions, despite the fact that the rule wouldn't get exposed so it wouldn't be possible to ever use these definitions. The net-result is slightly less recompilation when specialisation introduces rules. Related to #19836
* Fix LitRubbish being applied to values.Andreas Klebinger2021-05-191-12/+14
| | | | This fixes #19824
* Implement :info for record pattern synonyms (#19462)nineonine2021-05-193-12/+19
|
* Remove transitive information about modules and packages from interface filesMatthew Pickering2021-05-1917-233/+366
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit modifies interface files so that *only* direct information about modules and packages is stored in the interface file. * Only direct module and direct package dependencies are stored in the interface files. * Trusted packages are now stored separately as they need to be checked transitively. * hs-boot files below the compiled module in the home module are stored so that eps_is_boot can be calculated in one-shot mode without loading all interface files in the home package. * The transitive closure of signatures is stored separately This is important for two reasons * Less recompilation is needed, as motivated by #16885, a lot of redundant compilation was triggered when adding new imports deep in the module tree as all the parent interface files had to be redundantly updated. * Checking an interface file is cheaper because you don't have to perform a transitive traversal to check the dependencies are up-to-date. In the code, places where we would have used the transitive closure, we instead compute the necessary transitive closure. The closure is not computed very often, was already happening in checkDependencies, and was already happening in getLinkDeps. Fixes #16885 ------------------------- Metric Decrease: MultiLayerModules T13701 T13719 -------------------------
* Add some TcRn diagnostic messagesAlfredo Di Napoli2021-05-198-55/+154
| | | | | | | | | | | | | | | | | This commit converts some TcRn diagnostic into proper structured errors. Ported by this commit: * Add TcRnImplicitLift This commit adds the TcRnImplicitLift diagnostic message and a prototype API to be able to log messages which requires additional err info. * Add TcRnUnusedPatternBinds * Add TcRnDodgyExports * Add TcRnDodgyImports message * Add TcRnMissingImportList
* EPA: Fix incorrect SrcSpan for FamDeclAlan Zimmerman2021-05-121-1/+1
| | | | | | | The SrcSpan for a type family declaration did not include the family equations. Closes #19821
* Remove useless {-# LANGUAGE CPP #-} pragmasSylvain Henry2021-05-12255-303/+262
|
* Fully remove HsVersions.hSylvain Henry2021-05-12258-594/+77
| | | | | | | | | | Replace uses of WARN macro with calls to: warnPprTrace :: Bool -> SDoc -> a -> a Remove the now unused HsVersions.h Bump haddock submodule
* Replace CPP assertions with Haskell functionsSylvain Henry2021-05-12174-903/+1054
| | | | | | | | | | | | | | | There is no reason to use CPP. __LINE__ and __FILE__ macros are now better replaced with GHC's CallStack. As a bonus, assert error messages now contain more information (function name, column). Here is the mapping table (HasCallStack omitted): * ASSERT: assert :: Bool -> a -> a * MASSERT: massert :: Bool -> m () * ASSERTM: assertM :: m Bool -> m () * ASSERT2: assertPpr :: Bool -> SDoc -> a -> a * MASSERT2: massertPpr :: Bool -> SDoc -> m () * ASSERTM2: assertPprM :: m Bool -> SDoc -> m ()
* Ensure assert from Control.Exception isn't usedSylvain Henry2021-05-1210-13/+12
|
* Move GlobalVar macros into GHC.Utils.GlobalVarsSylvain Henry2021-05-122-6/+32
| | | | | That's the only place where they are used and they shouldn't be used elsewhere.
* W/W: Always zap useless idInfos.Andreas Klebinger2021-05-121-2/+28
| | | | | | | | | | | tryWW used to always returns an Id with a zapped: * DmdEnv * Used Once info except in the case where the ID was guaranteed to be inlined. We now also zap the info in that case. Fixes #19818.
* EPA: record annotations for braces in LetStmtAlan Zimmerman2021-05-111-3/+1
| | | | Closes #19814
* Fix strictness and arity info in SpecConstrSimon Peyton Jones2021-05-113-62/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In GHC.Core.Opt.SpecConstr.spec_one we were giving join-points an incorrect join-arity -- this was fallout from commit c71b220491a6ae46924cc5011b80182bcc773a58 Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Thu Apr 8 23:36:24 2021 +0100 Improvements in SpecConstr * Allow under-saturated calls to specialise See Note [SpecConstr call patterns] This just allows a bit more specialisation to take place. and showed up in #19780. I refactored the code to make the new function calcSpecInfo which treats join points separately. In doing this I discovered two other small bugs: * In the Var case of argToPat we were treating UnkOcc as uninteresting, but (by omission) NoOcc as interesting. As a result we were generating SpecConstr specialisations for functions with unused arguments. But the absence anlyser does that much better; doing it here just generates more code. Easily fixed. * The lifted/unlifted test in GHC.Core.Opt.WorkWrap.Utils.mkWorkerArgs was back to front (#19794). Easily fixed. * In the same function, mkWorkerArgs, we were adding an extra argument nullary join points, which isn't necessary. I added a test for this. That in turn meant I had to remove an ASSERT in CoreToStg.mkStgRhs for nullary join points, which was always bogus but now trips; I added a comment to explain.
* Document unfolding treatment of simplLamBndr.Andreas Klebinger2021-05-111-3/+5
| | | | Fixes #19817
* Don't warn about ClassOp bindings not specialising.Andreas Klebinger2021-05-112-0/+40
| | | | Fixes #19586
* EPA: Use custom AnnsIf structure for HsIf and HsCmdIfAlan Zimmerman2021-05-114-12/+26
| | | | | | | This clearly identifies the presence and location of optional semicolons in an if statement. Closes #19813
* Minor refactoring in WorkWrapSimon Peyton Jones2021-05-111-15/+7
| | | | | | This patch just does the tidying up from #19805. No change in behaviour.
* Expand Note [Data con representation].Andreas Klebinger2021-05-111-4/+30
| | | | Not perfect. But I consider this to be a documentation fix for #19789.
* EPA: properly capture leading semicolons in statement listsAlan Zimmerman2021-05-092-6/+8
| | | | | | | | | | | | | | For the fragment blah = do { ; print "a" ; print "b" } capture the leading semicolon before 'print "a"' in 'al_rest' in AnnList instead of in 'al_trailing'. Closes #19798
* EPA: update some comments in Annotations.Alan Zimmerman2021-05-081-119/+82
| | | | Follow-up from !2418, see #19579
* Fix newtype eta-reductionSimon Peyton Jones2021-05-073-18/+82
| | | | | | | | The eta-reduction we do for newype axioms was generating an inhomogeneous axiom: see #19739. This patch fixes it in a simple way; see GHC.Tc.TyCl.Build Note [Newtype eta and homogeneous axioms]
* Allow visible type application for levity-poly data consSimon Peyton Jones2021-05-0717-277/+473
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch was driven by #18481, to allow visible type application for levity-polymorphic newtypes. As so often, it started simple but grew: * Significant refactor: I removed HsConLikeOut from the client-independent Language.Haskell.Syntax.Expr, and put it where it belongs, as a new constructor `ConLikeTc` in the GHC-specific extension data type for expressions, `GHC.Hs.Expr.XXExprGhcTc`. That changed touched a lot of files in a very superficial way. * Note [Typechecking data constructors] explains the main payload. The eta-expansion part is no longer done by the typechecker, but instead deferred to the desugarer, via `ConLikeTc` * A little side benefit is that I was able to restore VTA for data types with a "stupid theta": #19775. Not very important, but the code in GHC.Tc.Gen.Head.tcInferDataCon is is much, much more elegant now. * I had to refactor the levity-polymorphism checking code in GHC.HsToCore.Expr, see Note [Checking for levity-polymorphic functions] Note [Checking levity-polymorphic data constructors]
* Disallow -XDerivingVia when -XSafe is on (#19786)Aaron Allen2021-05-061-1/+11
| | | | | Since `GeneralizedNewtypeDeriving` is considered unsafe, `DerivingVia` should be as well.
* EPA: properly capture semicolons between Matches in a FunBindAlan Zimmerman2021-05-063-25/+43
| | | | | | | | | | | | | | | For the source module MatchSemis where { a 0 = 1; a _ = 2; } Make sure that the AddSemiAnn entries for the two trailing semicolons are attached to the component Match elements. Closes #19784
* 19486 Nearly all uses of `uniqCompareFS` are dubious and lack a ↵Sasha Bogicevic2021-05-064-3/+10
| | | | non-determinism justification
* Re-introduce Note [keepAlive# magic]Ben Gamari2021-05-063-1/+148
| | | | | | | | Somewhere in the course of forward- and back-porting the keepAlive# branch the Note which described the mechanism was dropped. Reintroduce it. Closes #19712.
* support LiftedRep and UnliftedRep in GHCi FFILuite Stegeman2021-05-051-17/+19
| | | | fixes #19733
* More specific error messages for annotations (fixes #19740)Jaro Reinders2021-05-053-11/+13
|
* Add some DriverMessage type constructorsAlfredo Di Napoli2021-05-056-100/+267
| | | | | | | | | | | | | | | | | | | | | | | This commit expands the DriverMessage type with new type constructors, making the number of diagnostics GHC can emit richer. In particular: * Add DriverMissingHomeModules message * Add DriverUnusedPackage message * Add DriverUnnecessarySourceImports message This commit adds the `DriverUnnecessarySourceImports` message and fixes a small bug in its reporting: inside `warnUnnecessarySourceImports` we were checking for `Opt_WarnUnusedSourceImports` to be set, but we were emitting the diagnostic with `WarningWithoutFlag`. This also adjusts the T10637 test to reflect that. * Add DriverDuplicatedModuleDeclaration message * Add DriverModuleNotFound message * Add DriverFileModuleNameMismatch message * Add DriverUnexpectedSignature message * Add DriverFileNotFound message * Add DriverStaticPointersNotSupported message * Add DriverBackpackModuleNotFound message
* Persist CorePrepProv into IfaceUnivCoProvSimon Peyton Jones2021-05-0416-63/+84
| | | | | | | | | | | | | | | | CorePrepProv is only created in CorePrep, so I thought it wouldn't be needed in IfaceUnivCoProv. But actually IfaceSyn is used during pretty-printing, and we can certainly pretty-print things after CorePrep as #19768 showed. So the simplest thing is to represent CorePrepProv in IfaceSyn. To improve what Lint can do I also added a boolean to CorePrepProv, to record whether it is homogeneously kinded or not. It is introduced in two distinct ways (see Note [Unsafe coercions] in GHC.CoreToStg.Prep), one of which may be hetero-kinded (e.g. Int ~ Int#) beause it is casting a divergent expression; but the other is not. The boolean keeps track.
* Tweak function `quantifyType` to fix #12449Roland Senn2021-05-041-21/+9
| | | | | | | | | | | In function `compiler/GHC/Runtime/Heap/Inspect.hs:quantifyType` replace `tcSplitForAllInvisTyVars` by `tcSplitNestedSigmaTys`. This will properly split off the nested foralls in examples like `:print fmap`. Do not remove the `forall`s from the `snd` part of the tuple returned by `quantifyType`. It's not necessary and the reason for the bug in #12449. Some code simplifications at the calling sites of `quantifyTypes`.
* Improve hs-boot binds error (#19781)sheaf2021-05-032-10/+25
|
* visually align expected and actual modules nameiori tsu2021-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | before: > /home/matt/Projects/persistent/persistent/Database/Persist/ImplicitIdDef.hs:1:8: error: > File name does not match module name: > Saw: ‘A.B.Module’ > Expected: ‘A.B.Motule’ > | > 1 | module A.B.Motule > | ^^^^^^^^^^> after: > /home/matt/Projects/persistent/persistent/Database/Persist/ImplicitIdDef.hs:1:8: error: > File name does not match module name: > Saw: ‘A.B.Module’ > Expected: ‘A.B.Motule’ > | > 1 | module A.B.Motule > | ^^^^^^^^^^>
* pe: enable code unloading for WindowsTamar Christina2021-05-031-3/+0
|
* Make sized division primops ok-for-spec (#19026)Sylvain Henry2021-04-302-14/+47
|
* Bring tcTyConScopedTyVars into scope in tcClassDecl2Ryan Scott2021-04-306-30/+100
| | | | | | | | | | | It is possible that the type variables bound by a class header will map to something different in the typechecker in the presence of `StandaloneKindSignatures`. `tcClassDecl2` was not aware of this, however, leading to #19738. To fix it, in `tcTyClDecls` we map each class `TcTyCon` to its `tcTyConScopedTyVars` as a `ClassScopedTVEnv`. We then plumb that `ClassScopedTVEnv` to `tcClassDecl2` where it can be used. Fixes #19738.
* Make GHC.Runtime.Interpreter independent of GHC.DriverSylvain Henry2021-04-307-30/+36
|
* Interpreter: replace DynFlags with EvalOpts/BCOOptsSylvain Henry2021-04-304-45/+68
|
* Replace (ptext .. sLit) with `text`Sylvain Henry2021-04-2954-812/+783
| | | | | | | | | | | | | | | 1. `text` is as efficient as `ptext . sLit` thanks to the rewrite rules 2. `text` is visually nicer than `ptext . sLit` 3. `ptext . sLit` encourages using one `ptext` for several `sLit` as in: ptext $ case xy of ... -> sLit ... ... -> sLit ... which may allocate SDoc's TextBeside constructors at runtime instead of sharing them into CAFs.
* Propagate free variables in extract_lctxt correctlyRyan Scott2021-04-291-1/+1
| | | | | This fixes an oversight in the implementation of `extract_lctxt` which was introduced in commit ce85cffc. Fixes #19759.