Roman: yes, sorry - let's say that go is used in the body of the let.
Simon: right. However, I'm not so sure that CoreTidy? is actually preserving rules on local lets right now.. certainly nothing in tidyLetBndr seems to be using setIdSpecialisation or similar on the outgoing Id. I noticed this when writing the patch above and was actually wondering if was intentional...
I'm not sure if your proposed plan will work exactly as described because at any point after CoreTidy? (including in the output of CorePrep?) all top level binders are global ids and hence not reported as free variables. This causes the occurrence analyser to rewrite e.g.:
Rec { f = ... f ... -- Note that f is a globalid! }
To:
f = ... f ... -- Note that the Rec wrapper has vanished