Efficient Compilation of Complex Tensor Algebra Expressions