1. An apparatus to optimize memory locality involving code replication with fusion and permutation, the apparatus comprising: a storage device to store compiler code; and a processor to execute the compiler code to: determine whether code replication is legal with respect to data dependence for references within each innermost loop of a plurality of inner loops of a loop nest; determine legality of loop fusion with code replication across at least two adjacent loops of the plurality of inner loops; determine store operations that inhibit loop permutation from one-dimensional local arrays, wherein the determination of the store operations indicates if an elimination of the store operations after code replication and loop fusion is executed, wherein if it is determined not to eliminate the store operations, loop permutation is not permitted; and determine without loop distribution whether code replication by fusion is legal for loop interchange, wherein if the loop permutation is legal after replication and fusion, all inner loops that are indicated as fusible are merged to generate data dependencies for the entire loop nest and wherein each of the data dependencies is checked to determine if permutation legality checks are satisfied.