Scalar Replacement

The goal of scalar replacement, which is enabled by -scalar-rep (Linux*) or /Qscalar-rep (Windows*), is to reduce memory references. This is done mainly by replacing array references with register references.

While the compiler replaces some array references with register references when -O1 or -O2 (Linux) or /O1 or /O2 (Windows) is specified, more aggressive replacement is performed when -O3 (Linux) or /O3 (Windows) and -scalar-rep (Linux) or /Qscalar-rep (Windows) are specified. For example, with -O3 (Linux) or /O3 (Windows) the compiler attempts replacement when there are loop-carried dependences or when data dependency analysis is required for memory disambiguation.

The -scalar-rep (Linux) or /Qscalar-rep (Windows) compiler option enables (default) scalar replacement performed during loop transformations.