Thank you for answers.
As people respond on this thread, would you be willing to capture what you learn in a wiki page in the Commentary? I already created such a wiki page some time ago:
https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Core2CorePipeline But, since there are things I don't yet understant, this page is still incomplete.
Imported functions (eg foldr or build) have strictness and cardinality analysis info in their interface file signatures. That can in turn drive the attachment of one-shot info to binders. See one_shots = argsOneShots (idStrictness fun) n_val_args -- See Note [Use one-shot info] line 1345 of OccurAnal. And if we don't import anything then we're assuming NoOneShotInfo, which means we don't float in past lambdas?
Janek