Communication-Optimal Loop Nests