Skip to content

Improve worker/wrapper when no w/w is needed

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.

The solution is to move the conditional to later. Easy.

In investigating this I also discovered an outright bug; namely that the worker/wrapper phase would overwrite InlineCompulsory with InlineStable, which is utterly wrong. That in turn meant that some default methods (slightly oddly marked InlineCompulsory -- #17914) were getting their InlineCompulsory squashed.

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