Correct Answer - Option 2 : Local optimization
Concept:
Peephole optimization is a technique for locally improving the target code which is done by examining a sliding window of target instructions and replacing the instruction sequences within the peephole by shorter or faster sequences wherever possible.
Constant folding is a peephole optimization.
int a = 3 + 9;
int a = 12 \\constant folding
Important Point:
The code in the peephole need not be contiguous although some implementations do require this. Some characteristics of peephole optimization are:
- Redundant instruction elimination
- Elimination of unreachable code
- Reduction in strength
- Algebraic simplifications
- Use of machine idioms