mkClosureLFInfo could do a better job identifying thunks which are definitely not functions.
We currently determine based on a closures type if a thunk might be a function independently what the body of the function actually looks like. But at all call sites of mkClosureLFInfo
we have access to the actual function body. So we could very well determine more accurately if something is or isn't a function.
Why does this matter? It allows us to just enter the thunk instead of doing a slow call for code like:
let x = <thunk1>
...
case x of x' -> ...
We do need to take care because a indirection (let x = y in ...
) can be optimized to reference the indirectee by the linker. But that's easy to check against.
Not sure how much of an impact this would have. Likely a minor impact since we don't allocate thunks and enter them later in the same function all that often.