Don't drop ticks around variables of type IO ()

Ticket: #27225 (closed)

GHC.Core.Utils.mkTick is responsible for placing a tick on a Core expression. It contains logic for dropping SCCs (non-counting profiling ticks) around non-function variables, as such variables cannot meaningfully contribute to profiles. However, the logic for what counts as a function was incorrect: it used isFunTy which returns False for types such as IO () where the function arrow is hidden under a newtype.

We now use mightBeFunTy instead of isFunTy. This ensures we don't drop ticks in cases we aren't sure.

On the way, we improve the documentation of mightBeFunTy and update its implementation to consistently handle unary classes.

TODO:

  • Improve documentation of isFunTy and related functions (e.g. isPiTy).
Edited by sheaf

Merge request reports

Loading