SPRUIG8J January 2018 – March 2024
Induction variables are variables whose value within a loop is directly related to the number of executions of the loop. Array indices and control variables for loops are often induction variables.
Strength reduction is the process of replacing inefficient expressions involving induction variables with more efficient expressions. For example, code that indexes into a sequence of array elements is replaced with code that increments a pointer through the array.
Induction variable analysis and strength reduction together often remove all references to your loop-control variable, allowing its elimination.
This type of optimization is enabled by the --opt_level=2 and higher optimization settings.