| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
| |
addressing rwbarton’s concerns in
https://phabricator.haskell.org/rGHC18ac80ff729e#66197
Differential Revision: https://phabricator.haskell.org/D3511
|
|
|
|
| |
Our new CPP linter enforces this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The C code in the RTS now gets built with `-Wundef` and the Haskell code
(stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever
`#if` is used on undefined identifiers.
Test Plan: Validate on Linux and Windows
Reviewers: austin, angerman, simonmar, bgamari, Phyx
Reviewed By: bgamari
Subscribers: thomie, snowleopard
Differential Revision: https://phabricator.haskell.org/D3278
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch in in preparation for the fix to Trac #13397
The code generator has a special case for
case tagToEnum (a>#b) of
False -> e1
True -> e2
but it was not doing nearly so well on
case a>#b of
DEFAULT -> e1
1# -> e2
This patch arranges to behave essentially identically in
both cases. In due course we can eliminate the special
case for tagToEnum#, once we've completed Trac #13397.
The changes are:
* Make CmmSink swizzle the order of a conditional where necessary;
see Note [Improving conditionals] in CmmSink
* Hack the general case of StgCmmExpr.cgCase so that it use
NoGcInAlts for conditionals. This doesn't seem right, but it's
the same choice as the tagToEnum version. Without it, code size
increases a lot (more heap checks).
There's a loose end here.
* Add comments in CmmOpt.cmmMachOpFoldM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
See Note [Scrutinee Constant Folding] in SimplUtils
* Add cases for tagToEnum and dataToTag. This is the main new
bit. It allows the simplifier to remove the pervasive uses
of case tagToEnum (a > b) of
False -> e1
True -> e2
and replace it by the simpler
case a > b of
DEFAULT -> e1
1# -> e2
See Note [caseRules for tagToEnum]
and Note [caseRules for dataToTag] in PrelRules.
* This required some changes to the API of caseRules, and hence
to code in SimplUtils. See Note [Scrutinee Constant Folding]
in SimplUtils.
* Avoid duplication of work in the (unusual) case of
case BIG + 3# of b
DEFAULT -> e1
6# -> e2
Previously we got
case BIG of
DEFAULT -> let b = BIG + 3# in e1
3# -> let b = 6# in e2
Now we get
case BIG of b#
DEFAULT -> let b = b' + 3# in e1
3# -> let b = 6# in e2
* Avoid duplicated code in caseRules
A knock-on refactoring:
* Move Note [Word/Int underflow/overflow] to Literal, as
documentation to accompany mkMachIntWrap etc; and get
rid of PrelRuls.intResult' in favour of mkMachIntWrap
|
|
|
|
| |
Just a simple refactoring to remove duplication
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, dfeuer
Subscribers: dfeuer, rwbarton, thomie
GHC Trac Issues: #13629
Differential Revision: https://phabricator.haskell.org/D3508
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
extendCSRecEnv took the map to be extended from cs_map instead of
cs_rec_map. Oops!
Test Plan: Validate
Reviewers: simonpj, austin
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3510
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It turns out we were using two different sets of type variables when
reifying data family instances in Template Haskell. We were using the
tyvars quantifying over the instance itself for the LHS, but using the
tyvars quantifying over the data family instance constructor for the
RHS. This commit uses the instance tyvars for both the LHS and the RHS,
fixing #13618.
Test Plan: make test TEST=T13618
Reviewers: goldfire, austin, bgamari
Reviewed By: goldfire, bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13618
Differential Revision: https://phabricator.haskell.org/D3505
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we see f (g x), and f is strict, we want to be a bit more eager to
inline g, because it may well expose an eval (on x perhaps) that can
be eliminated or shared.
I saw this in nofib boyer2, function RewriteFuns.onewayunify1. It
showed up as a consequence of the preceding patch that makes the
simplifier do less work (Trac #13379). We had
f d (g x)
where f was a class-op. Previously we simplified both d and
(g x) with a RuleArgCtxt (making g a bit more eager to inline).
But now we simplify only d that way, then fire the rule, and
only then simplify (g x). Firing the rule produces a strict
funciion, so we want to make a strict function encourage
inlining a bit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch nails a Bad Bug exposed in Trac #13379. Roughly,
a deeply-nested application like
f (f (f ....) ) )
could make the simplifier go exponential -- without producing
an exponential-sized result!
The reason was that we
- simplified a (big) function argument
- then decided to inline the function
- then preInilneUnconditionally the argument
- and then re-simplified the big argument
And if the "big argument" itself had a similar structure
things could get very bad.
Once I'd understood, it was easy to fix:
* See Note Note [Avoiding exponential behaviour] for an overview
* The key change is that Simplify.simplLam now as a case for
(isSimplified dup). This is what removes the perf bug.
* But I also made simplCast more parsimonious about simplifying,
avoiding doing so when the coercion is Refl
* And similarly I now try to avoid simplifying arguments
where possible before applying rules.
See Note [Trying rewrite rules]
The latter two points tackle common cases, and in those cases make the
simplifier take fewer iterations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CoreArity.etaExpand tried to deal with eta-expanding expressions
with join points. For example
let j x = e in \y. b
But it is hard to eta-expand this in the "no-crap" way described in
Note [No crap in eta-expanded code], becuase it would mean pushing
the "apply to y" into the join RHS, and changing its type. And the
join might be recursive, and it might have an unfolding.
Moreover in elaborate cases like this I don't think we need the
no-crap thing. So for now I'm simplifying the code by generating
\z. (let j x = e in \y. b) z
Let's see if that gives rise to any problems.
See Note [Eta expansion for join points]
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Also bumps Cabal submodule due to version bound bump.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: validate
Reviewers: bgamari, austin
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3501
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: simonmar, austin
Reviewed By: simonmar
Subscribers: RyanGlScott, rwbarton, thomie
GHC Trac Issues: #10640, #13611
Differential Revision: https://phabricator.haskell.org/D3498
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we were unconditionally pretty-printing all type variable
binders when pretty-printing closed type families (e.g., in the output
of `:info` in GHCi). This threw me for a loop, so let's guard this behind
the `-fprint-explicit-foralls` flag.
Test Plan: make test TEST=T13420
Reviewers: goldfire, austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13420
Differential Revision: https://phabricator.haskell.org/D3497
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Provide PowerPC optimised implementations of callish prim ops.
MO_?_QuotRem
The generic implementation of quotient remainder prim ops uses
a division and a remainder operation. There is no remainder on
PowerPC and so we need to implement remainder "by hand" which
results in a duplication of the divide operation when using the
generic code.
Avoid this duplication by implementing the prim op in the native
code generator.
MO_U_Mul2
Use PowerPC's instructions for long multiplication.
Addition and subtraction
Use PowerPC add/subtract with carry/overflow instructions
MO_Clz and MO_Ctz
Use PowerPC's CNTLZ instruction and implement count trailing
zeros using count leading zeros
MO_QuotRem2
Implement an algorithm given by Henry Warren in "Hacker's Delight"
using PowerPC divide instruction. TODO: Use long division instructions
when available (POWER7 and later).
Test Plan: validate on AIX and 32-bit Linux
Reviewers: simonmar, erikd, hvr, austin, bgamari
Reviewed By: erikd, hvr, bgamari
Subscribers: trofi, kgardas, thomie
Differential Revision: https://phabricator.haskell.org/D2973
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consider one-line module
module B (v) where v = "hello"
in -fvia-C mode it generates code like
static char gibberish_str[] = "hello";
It resides in data section (precious resource on ia64!).
The patch switches genrator to emit:
static const char gibberish_str[] = "hello";
Other types if symbols that gained 'const' qualifier are:
- info tables (from haskell and CMM)
- static reference tables (from haskell and CMM)
Cleanups along the way:
- fixed info tables defined in .cmm to reside in .rodata
- split out closure declaration into 'IC_' / 'EC_'
- added label declaration (based on label type) right before
each label definition (based on section type) so that C
compiler could check if declaration and definition matches
at definition site.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: ran testsuite on unregisterised x86_64 compiler
Reviewers: simonmar, ezyang, austin, bgamari, erikd
Reviewed By: bgamari, erikd
Subscribers: rwbarton, thomie
GHC Trac Issues: #8996
Differential Revision: https://phabricator.haskell.org/D3481
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This both says what we mean and silences a bunch of spurious CPP linting
warnings. This pragma is supported by all CPP implementations which we
support.
Reviewers: austin, erikd, simonmar, hvr
Reviewed By: simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3482
|
|
|
|
| |
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
| |
as proposed in #13588.
Differential Revision: https://phabricator.haskell.org/D3467
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before we were decoding the whole file to get to the desired line. This
patch introduces a fast function which searches a StringBuffer for the
desired line so we only need to utf8 decode a little portion.
This is especially interesting if we have big modules with lots of
warnings.
Reviewers: austin, bgamari, Rufflewind, trofi
Reviewed By: Rufflewind, trofi
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3440
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are asymptotically better and convey the intent
a bit better.
Test Plan: ./validate
Reviewers: simonpj, bgamari, austin, goldfire
Reviewed By: bgamari
Subscribers: rwbarton, thomie, simonmar
Differential Revision: https://phabricator.haskell.org/D3455
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, bgamari, dfeuer
Reviewed By: bgamari, dfeuer
Subscribers: rwbarton, thomie
GHC Trac Issues: #13392
Differential Revision: https://phabricator.haskell.org/D3461
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, hvr
Subscribers: rwbarton, thomie
GHC Trac Issues: #13527
Differential Revision: https://phabricator.haskell.org/D3442
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before ghc-7.2 hs_add_root() had to be used to initialize haskell
modules when haskell was called from FFI.
commit a52ff7619e8b7d74a9d933d922eeea49f580bca8
("Change the way module initialisation is done (#3252, #4417)")
removed needs for hs_add_root() and made function a no-op.
For backward compatibility '__stginit_<module>' symbol was
not removed.
This change removes no-op hs_add_root() function and unused
'__stginit_<module>' symbol from each haskell module.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: ./validate
Reviewers: simonmar, austin, bgamari, erikd
Reviewed By: simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3460
|
|
|
|
|
|
|
|
|
| |
Spelling if warning message slightly mismathed passed commandline:
$ ghc-stage2 -split-objs -C N.hs
on the commandline: warning: ignoring -fsplit-objs
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
| |
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
| |
This fixes a very simple typo in TcErrors.hs. I hope this is small
enough in scope to be accepted through GitHub.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This patch
* removes a function TcMType.quantifyTyVars
that was never called
* renames quantifyZonkedTyVars to quantifyTyVars
Plus a few comments. No functional change at all
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The proximate cause for this patch is Trac #13482, which pointed out
further subtle interactions between
- Inferring the most general type of a function
- A partial type signature for that function
That led me into /further/ changes to the shiny new stuff in
TcSimplify.simplifyInfer, decideQuantification, decideMonoTyVars,
and related functions.
Happily, I was able to make some of it quite a bit simpler,
notably the bit about promoting free tyvars. I'm happy with
the result.
Moreover I fixed Trac #13524 at the same time. Happy days.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
RnEnv contains functions which convertn RdrNames into Names.
RnUnbound contains helper functions for reporting and creating
unbound variables.
RnFixity contains code which maintains the fixity environent
whilst renaming.
RnUtils contains the other stuff in RnEnv.
Reviewers: austin, goldfire, bgamari
Subscribers: goldfire, rwbarton, thomie, snowleopard
Differential Revision: https://phabricator.haskell.org/D3436
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
iOS at least since iOS8 (we are currently at iOS10.3), allows for
dynamic libaries, hence any artificail restriction on dyanmic
libraries should be lifted.
Please ping me with any iOS related issues that should potentially
resurface. The iOS toolchain has considerably changed over the
years, and I'm willing to drop work arounds in good faith.
Reviewers: bgamari, austin
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13559, #7722
Differential Revision: https://phabricator.haskell.org/D3451
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When doing this I noticed a horrible amount of duplication between
lookupSubBndrOcc and lookupExportChild (which I am responsible for).
I opened #13545 to keep track of this.
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13528
Differential Revision: https://phabricator.haskell.org/D3434
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It told me to use -fno-suppress-ticks, but it should have been
-dno-suppress-ticks.
Test Plan: tested -dppr-ticks and -frewrite-rules manually
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3430
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Test on x86 and x86_64
Reviewers: duncan, trofi, simonmar, tibbe, hvr, austin, rwbarton,
bgamari
Reviewed By: duncan
Subscribers: Phyx, DemiMarie, rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3358
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
unless (not ..) -> when
Remove unused getLookupOccRn
Remove lookupGreRn2
It was only called in one place in a very strange way. It is easier
to just use lookupGreRn which has nearly the same implementation and
then directly call `unboundName`.
Remove unused function mapFvRnCPS
Remove unused functions bindLocatedLocalsRn and bindLocatedLocalsFV
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3435
|
|
|
|
|
|
|
|
| |
This fixes Trac #13558, by making App and Let behave
consistently; see Note [Arguments and let-bindings exprIsCheapX]
I renamed the mysterious exprIsOk to exprIsCheapX. (The "X"
is because it is parameterised over a CheapAppFun.)
|
| |
|
|
|
|
|
|
|
| |
We were failing to float a nested binding
x :: Addr# = "foo"#
to top level, even though we /were/ floating string
literals themselves. A small oversight, easily fixed.
|
|
|
|
|
|
|
|
|
| |
I realised (Trac #13543) that we can improve demand analysis for
join point quite straightforwardly.
The idea is explained in
Note [Demand analysis for join points]
in DmdAnal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When doing type-in-type, Richard introduce some substantial
complications in CoreFVs, gathering types and free variables
of type. In Trac #13160 we decided that this complication was
unnecessary, so this patch removes it.
Unfortnately I then fell down a twisty rabbit hole. Roughly:
* An apparently-innocuous change in the AnnApp case of
fiExpr made the fuction a little bit stricter, so we ended
up peering into the arguments when we didn't before (namely
when there are no bindings being floated inwards). I've
rejigged it so that it's not fragile any more.
* Peering into the arguments was sometimes expensive, becuase
exprIsExpandable can be expensive because it looks deeply into
the expression.
* The combination of the two led to a non-linear explosion
of work when the argument of a function is a deeep nest
of constructors. This bug has been lurking for ages.
I solved it by replacing exprIsExpandable with exprIsHNF
+ exprIsTrivial; see Note [noFloatInto considerations]
* The code around floating case-expressions turned out to be
very delicate, because can_fail primops (which we want to
float inwards) can't be floated outwards; so we have to be
careful never to float them too far. Note [Floating primops]
has the details
* I ended up refactoring some rather opaque code in
sepBindsByDropPoint.
Working all this out meant that I rewrote quite a bit of
code, so it's now a reasonably substantial patch. But it's
a net improvement.
|
| |
|