Optimise nullary type constructor usage
During the compilation of programs GHC very frequently deals with the `Type` type, which is a synonym of `TYPE 'LiftedRep`. This patch teaches GHC to avoid expanding the `Type` synonym (and other nullary type synonyms) during type comparisons, saving a good amount of work. This optimisation is described in `Note [Comparing nullary type synonyms]`. To maximize the impact of this optimisation, we introduce a few special-cases to reduce `TYPE 'LiftedRep` to `Type`. See `Note [Prefer Type over TYPE 'LiftedPtrRep]`. Closes #17958. Metric Decrease: T18698b T1969 T12227 T12545 T12707 T14683 T3064 T5631 T5642 T9020 T9630 T9872a T13035 haddock.Cabal haddock.base
Showing
- compiler/GHC/Builtin/Types.hs 6 additions, 3 deletionscompiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs 0 additions, 4 deletionscompiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/Builtin/Types/Prim.hs-boot 5 additions, 0 deletionscompiler/GHC/Builtin/Types/Prim.hs-boot
- compiler/GHC/Core/TyCo/Rep.hs 67 additions, 18 deletionscompiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Subst.hs 3 additions, 1 deletioncompiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCon.hs 8 additions, 6 deletionscompiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Type.hs 88 additions, 19 deletionscompiler/GHC/Core/Type.hs
- compiler/GHC/Core/Unify.hs 6 additions, 1 deletioncompiler/GHC/Core/Unify.hs
- compiler/GHC/Tc/Solver/Canonical.hs 5 additions, 0 deletionscompiler/GHC/Tc/Solver/Canonical.hs
- compiler/GHC/Tc/Utils/TcMType.hs 0 additions, 1 deletioncompiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/TcType.hs 5 additions, 0 deletionscompiler/GHC/Tc/Utils/TcType.hs
- testsuite/tests/deSugar/should_compile/T2431.stderr 3 additions, 3 deletionstestsuite/tests/deSugar/should_compile/T2431.stderr
- testsuite/tests/deriving/should_compile/T14578.stderr 3 additions, 4 deletionstestsuite/tests/deriving/should_compile/T14578.stderr
- testsuite/tests/plugins/plugins09.stdout 0 additions, 1 deletiontestsuite/tests/plugins/plugins09.stdout
- testsuite/tests/plugins/plugins10.stdout 0 additions, 1 deletiontestsuite/tests/plugins/plugins10.stdout
- testsuite/tests/plugins/plugins11.stdout 0 additions, 1 deletiontestsuite/tests/plugins/plugins11.stdout
- testsuite/tests/plugins/static-plugins.stdout 2 additions, 2 deletionstestsuite/tests/plugins/static-plugins.stdout
- testsuite/tests/printer/T18052a.stderr 3 additions, 3 deletionstestsuite/tests/printer/T18052a.stderr
- testsuite/tests/simplCore/should_compile/T13143.stderr 3 additions, 3 deletionstestsuite/tests/simplCore/should_compile/T13143.stderr
- testsuite/tests/simplCore/should_compile/T18013.stderr 2 additions, 2 deletionstestsuite/tests/simplCore/should_compile/T18013.stderr
Loading
Please register or sign in to comment