Skip to content

Float-out is not idempotent

Consider

f x = BIG

where BIG is bottoming. In HEAD, the float-out pass decides to float BIG to the top level, producing

lvl x = BIG
f x = lvl x

which is obviously stupid.

There's a whole Note to explain this problem and how we avoid it:

Note [Floating from a RHS]
~~~~~~~~~~~~~~~~~~~~~~~~~~
When float the RHS of a let-binding, we don't always want to apply
lvlMFE to the body of a lambda, as we usually do, because the entire
binding body is already going to the right place (dest_lvl).

A particular example is the top level.  Consider
   concat = /\ a -> foldr ..a.. (++) []
We don't want to float the body of the lambda to get
   lvl    = /\ a -> foldr ..a.. (++) []
   concat = /\ a -> lvl a
That would be stupid.

But I forgot to take account of the possibility that abs_vars might abstract over Ids. Easily fixed.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information