Static Argument Transformation for tail-recursive functions
In #13966 it was determined that having a variant of the Static Argument Transformation (StaticArgumentTransformation) pass that would specifically work on recursive join points, would be beneficial. This ticket tracks this task.
Consider
joinrec $j x y = case y of
A -> $j x y'
B -> e2 x
C -> e3
in $j foo bar
Here the first argument to $j
is "static"; that is, the same in every call. So we can transform like this
joinrec $j y = case y of
A -> $j y'
B -> e2 foo
C -> e3
in $j bar
Note that x
isn't passed around in every iteration any more.