Skip to content

-fno-worker-wrapper should trim Boxity and CPR

Consider

{-# OPTIONS_GHC -fno-worker-wrapper #-}

module Test where

f :: Int -> Int
f n = n+1
{-# NOINLINE f #-}

This will produce the following signatures in simplified Core:

f [InlPrag=NOINLINE] :: Int -> Int
[GblId, Arity=1, Str=<1!P(L)>, Cpr=1, Unf=OtherCon []]
f = \ (n_aum :: Int) ->
      case n_aum of { GHC.Types.I# x_ayo ->
      GHC.Types.I# (GHC.Prim.+# x_ayo 1#)
      }

NB: Both boxity and Cpr annotations are incorrect, because f will never inline. Thus we will never be able to cancel away the boxes.

Proposal

To fix this, we have to add a Bool to DmdOpts/CprOpts to track whether -fno-worker-wrapper is set and clear boxity/CPR accordingly.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information