It would be nice to unpack TCO loops, such that TCO arguments that are always known constructors don't need allocations. This would give us something comparable to call-pattern-specialization in the TCO pass. We essentially already do this for mutually recursive TCO bindings, as a special case.
It doesn't strictly need to be a TCO pass, as it would obviously be nice to have this even when the backend doesn't need TCO. It just seems like a straightforward extension for now.
Additionally, by doing it as part of codegen, we can avoid an explosion of specialized bindings (one for every specialization of constructors).
It would be nice to unpack TCO loops, such that TCO arguments that are always known constructors don't need allocations. This would give us something comparable to call-pattern-specialization in the TCO pass. We essentially already do this for mutually recursive TCO bindings, as a special case.
It doesn't strictly need to be a TCO pass, as it would obviously be nice to have this even when the backend doesn't need TCO. It just seems like a straightforward extension for now.
Additionally, by doing it as part of codegen, we can avoid an explosion of specialized bindings (one for every specialization of constructors).