
#16039: 'GHC.Magic.noinline <var>' should not float out -------------------------------------+------------------------------------- Reporter: heisenbug | Owner: heisenbug Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: FloatOut Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #15155 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by heisenbug): I have a one-liner patch that now correctly judges `ghc- prim-0.5.3:GHC.Magic.noinline @ Kind liftedTypeKind` as not-worth-for- floating, but I have found another context (floating of specialised class dicts) when this is not enough. To diagnose this, I have instrumented my stage2 with traces and get (while compiling `TcHsType.hs`) : {{{ lvlMFE WORTH (noinline @ (HasDebugCallStack => Role -> TyCon -> [Coercion] -> Coercion) mkTyConAppCo C:(%%), noinline @ (Coercion -> Coercion -> Coercion) mkAppCo, noinline @ (CoAxiom Branched -> BranchIndex -> [Coercion] -> Coercion) mkAxiomInstCo, noinline @ (UnivCoProvenance -> Role -> Type -> Type -> Coercion) mkUnivCo, noinline @ (Coercion -> Coercion) mkSymCo, noinline @ (Coercion -> Coercion -> Coercion) mkTransCo, noinline @ (HasDebugCallStack => Role -> Int -> Coercion -> Coercion) mkNthCo C:(%%), noinline @ (LeftOrRight -> Coercion -> Coercion) mkLRCo, noinline @ (Coercion -> Coercion -> Coercion) mkInstCo, noinline @ (Coercion -> Coercion) mkKindCo, noinline @ (Coercion -> Coercion) mkSubCo, noinline @ (TyCoVar -> Coercion -> Coercion -> Coercion) mkForAllCo, noinline @ (Role -> Type -> MCoercionN -> Coercion) mkGReflCo) lvlMFE WORTH noinline @ (HasDebugCallStack => Role -> TyCon -> [Coercion] -> Coercion) mkTyConAppCo C:(%%) lvlMFE NOTWORTH mkTyConAppCo lvlMFE NOTWORTH C:(%%) lvlMFE NOTWORTH noinline @ (Coercion -> Coercion -> Coercion) mkAppCo lvlMFE NOTWORTH mkAppCo lvlMFE NOTWORTH noinline @ (CoAxiom Branched -> BranchIndex -> [Coercion] -> Coercion) mkAxiomInstCo lvlMFE NOTWORTH mkAxiomInstCo lvlMFE NOTWORTH noinline @ (UnivCoProvenance -> Role -> Type -> Type -> Coercion) mkUnivCo lvlMFE NOTWORTH mkUnivCo lvlMFE NOTWORTH noinline @ (Coercion -> Coercion) mkSymCo lvlMFE NOTWORTH mkSymCo lvlMFE NOTWORTH noinline @ (Coercion -> Coercion -> Coercion) mkTransCo lvlMFE NOTWORTH mkTransCo lvlMFE WORTH noinline @ (HasDebugCallStack => Role -> Int -> Coercion -> Coercion) mkNthCo C:(%%) lvlMFE NOTWORTH mkNthCo lvlMFE NOTWORTH C:(%%) lvlMFE NOTWORTH noinline @ (LeftOrRight -> Coercion -> Coercion) mkLRCo lvlMFE NOTWORTH mkLRCo lvlMFE NOTWORTH noinline @ (Coercion -> Coercion -> Coercion) mkInstCo lvlMFE NOTWORTH mkInstCo lvlMFE NOTWORTH noinline @ (Coercion -> Coercion) mkKindCo lvlMFE NOTWORTH mkKindCo lvlMFE NOTWORTH noinline @ (Coercion -> Coercion) mkSubCo lvlMFE NOTWORTH mkSubCo lvlMFE NOTWORTH noinline @ (TyCoVar -> Coercion -> Coercion -> Coercion) mkForAllCo lvlMFE NOTWORTH mkForAllCo lvlMFE NOTWORTH noinline @ (Role -> Type -> MCoercionN -> Coercion) mkGReflCo lvlMFE NOTWORTH mkGReflCo }}} Here `noinline @ (Role -> Type -> MCoercionN -> Coercion) mkGReflCo` is considered NOTWORTH for floating, but even with that the algorithm descends into it, and eventually the expression gets floated. I have to figure out why this is the case. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16039#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler