Make the specialiser handle polymorphic specialisation
Ticket #13873 unexpectedly showed that a SPECIALISE pragma made a program run (a lot) slower, because less specialisation took place overall. It turned out that the specialiser was missing opportunities because of quantified type variables. It was quite easy to fix. The story is given in Note [Specialising polymorphic dictionaries] Two other minor fixes in the specialiser * There is no benefit in specialising data constructor /wrappers/. (They can appear overloaded because they are given a dictionary to store in the constructor.) Small guard in canSpecImport. * There was a buglet in the UnspecArg case of specHeader, in the case where there is a dead binder. We need a LitRubbish filler for the specUnfolding stuff. I expanded Note [Drop dead args from specialisations] to explain. There is a 4% increase in compile time for T13056, because we generate more specialised code. This seems OK. Metric Increase: T13056
Showing
- compiler/GHC/Core/Opt/Specialise.hs 172 additions, 50 deletionscompiler/GHC/Core/Opt/Specialise.hs
- testsuite/tests/simplCore/should_compile/T13873.hs 24 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T13873.hs
- testsuite/tests/simplCore/should_compile/T13873.stderr 8 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T13873.stderr
- testsuite/tests/simplCore/should_compile/T8331.stderr 97 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T8331.stderr
- testsuite/tests/simplCore/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/simplCore/should_compile/all.T
Loading
Please register or sign in to comment