Skip to content

Avoid useless w/w split, take 2

Simon Peyton Jones requested to merge wip/T17917a into master

This commit:

    commit c6faa42bfb954445c09c5680afd4fb875ef03758
    Author: Simon Peyton Jones <simonpj@microsoft.com>
    Date:   Mon Mar 9 10:20:42 2020 +0000

    Avoid useless w/w split

    This patch is just a tidy-up for the post-strictness-analysis
    worker wrapper split.  Consider

       f x = x

    Strictnesss analysis does not lead to a w/w split, so the
    obvious thing is to leave it 100% alone.  But actually, because
    the RHS is small, we ended up adding a StableUnfolding for it.

    There is some reason to do this if we choose /not/ do to w/w
    on the grounds that the function is small.  See
    Note [Don't w/w inline small non-loop-breaker things]

    But there is no reason if we would not have done w/w anyway.

    This patch just moves the conditional to later.  Easy.

turns out to have a bug in it. Instead of /moving/ the conditional, I /duplicated/ it. Then in a subsequent unrelated tidy-up (087ac4eb) I removed the second (redundant) test!

This patch does what I originally intended.

There is also a small refactoring in GHC.Core.Unfold, to make the code clearer, but with no change in behaviour.

Fixes #17917 (closed) (again)

Edited by Simon Peyton Jones

Merge request reports