loop fusion ⇝
loop combinationA program transformation where the bodies of two loops are merged into one thus reducing the overhead of manipulating and testing the control variable and branching. Further optimisation of the merged code may then become possible. In horizontal loop combination the bodies of the loops are largely independent so only the loop overhead is saved. Vertical loop combination applies where the results of the first loop are used by the second. Combining the two allows the intermediate results to be used immediately (in registers) rather than requiring them to be stored in an array. The functional equivalent of horizontal and vertical loop combination are tupling and fusion.