Skip to content

Avoid useless w/w split

Simon Peyton Jones requested to merge wip/T17917 into master

This patch is 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. This does move soem -ddump-simpl printouts around a bit.

I also discovered that the previous code was overwriting an InlineCompulsory with InlineStable, which is utterly wrong. That in turn meant that some default methods (marked InlineCompulsory) were getting their InlineCompulsory squashed. This patch fixes that bug --- but of course that does mean a bit more inlining!

Fixes #17917 (closed)

Edited by Ben Gamari

Merge request reports