Commits on Source (2)
-
Sebastian Graf authored
See `Note [Pin evaluatedness on floats]`.
e4a7f0b8 -
Sebastian Graf authored
This patch tweaks `exprIsConApp_maybe`, `exprIsHNF` and friends, and Demand Analysis so that they exploit and maintain strictness of DataCon workers. See `Note [Strict fields in Core]` for details. Very little needed to change, and it puts field seq insertion done by Tag Inference into a new perspective: That of *implementing* strict field semantics. Before Tag Inference, DataCon workers are strict. Afterwards they are effectively lazy and field seqs happen around use sites. History has shown that there is no other way to guarantee taggedness and thus the STG Strict Field Invariant. Knock-on changes: * `exprIsHNF` previously used `exprOkForSpeculation` on unlifted arguments instead of recursing into `exprIsHNF`. That regressed the termination analysis in CPR analysis (which simply calls out to `exprIsHNF`), so I made it call `exprOkForSpeculation`, too. * There's a small regression in Demand Analysis, visible in the changed test output of T16859: Previously, a field seq on a variable would give that variable a "used exactly once" demand, now it's "used at least once", because `dmdTransformDataConSig` accounts for future uses of the field that actually all go through the case binder (and hence won't re-enter the potential thunk). The difference should hardly be observable. * The Simplifier's fast path for data constructors only applies to lazy data constructors now. I observed regressions involving Data.Binary.Put's `Pair` data type. * Unfortunately, T21392 does no longer reproduce after this patch, so I marked it as "not broken" in order to track whether we regress again in the future. Fixes #20749, the satisfying conclusion of an annoying saga (cf. the ideas in #21497 and #22475). Co-Authored-By:
Jaro Reinders <jaro.reinders@gmail.com>
a4713774
Showing
- compiler/GHC/Builtin/Types.hs 2 additions, 0 deletionscompiler/GHC/Builtin/Types.hs
- compiler/GHC/Core.hs 70 additions, 1 deletioncompiler/GHC/Core.hs
- compiler/GHC/Core/DataCon.hs 68 additions, 67 deletionscompiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/Opt/Arity.hs 1 addition, 1 deletioncompiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CprAnal.hs 14 additions, 6 deletionscompiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/DmdAnal.hs 4 additions, 0 deletionscompiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs 2 additions, 9 deletionscompiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs 6 additions, 6 deletionscompiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/SimpleOpt.hs 38 additions, 7 deletionscompiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Type.hs 14 additions, 1 deletioncompiler/GHC/Core/Type.hs
- compiler/GHC/Core/Utils.hs 156 additions, 122 deletionscompiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg/Prep.hs 158 additions, 28 deletionscompiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Stg/InferTags.hs 26 additions, 8 deletionscompiler/GHC/Stg/InferTags.hs
- compiler/GHC/Stg/InferTags/Rewrite.hs 2 additions, 2 deletionscompiler/GHC/Stg/InferTags/Rewrite.hs
- compiler/GHC/Tc/Instance/Class.hs 1 addition, 1 deletioncompiler/GHC/Tc/Instance/Class.hs
- compiler/GHC/Tc/TyCl/Build.hs 3 additions, 2 deletionscompiler/GHC/Tc/TyCl/Build.hs
- compiler/GHC/Types/Demand.hs 35 additions, 28 deletionscompiler/GHC/Types/Demand.hs
- compiler/GHC/Types/Id/Info.hs 1 addition, 1 deletioncompiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/Id/Make.hs 22 additions, 20 deletionscompiler/GHC/Types/Id/Make.hs
- compiler/GHC/Utils/Misc.hs 25 additions, 1 deletioncompiler/GHC/Utils/Misc.hs