Perform polymorphism boxing after optimization
@phischu
def foo[A](x: Int){ bar: Int => A }: A = {
bar(x)
}
def baz(x: Int): Int = {
if (x > 0) {
foo(x - 1){baz}
} else { 0 }
}
def main() = {
println(baz(10))
}
This massively reduces the performance in some of our benchmarks, most notably list_tail. Polymorphism-boxing a match introduces a local binding for each clause that seems to not be inlined by llvm. We should avoid introducing a freshly-bound block when we are coercing a BlockLit
Nice, looks like only the PolyBoxingTests need to be adjusted now. Good job!
This seems to fix #1012 and #1030 and also comes with other improvements. It is not the end of the polymorphism story but I believe we should review and merge it eventually.
As a follow-up it will also allow us to delete the special casing for LLVM in the optimizer here.
@mattisboeckle please fix the failing tests by updating the expected values.
While at it, maybe you can also add tests for #1012 and #1030 so we can immediately close them.
The tests still fail. I get values are not equal even if they have the same toString()
So some variable is not getting renamed. I could not figure out which one
@marzipankaiser Pls take a look
Super, now rebase this onto master (and force push to this branch).