Integrated Compiler Optimizations For Tensor Contractions