Introduction
The concept of optimization revolves around the basic block. Block Optimization does not involve changes in computational results from the set of operations.

The two different scenarios of Block Optimization are as given below
- Structure-Preserving Transformations
- Algebraic Transformations
Also See, Top Down Parsing
Structure-Preserving Transformations
The Structure-Preserving Transformations in basic Block Optimization include
- Elimination of common sub-expression
- Elimination of Dead Code
- Renaming the temporary variables
- Interchanging two adjacent independent statements
Elimination of Common Sub-Expression
In this elimination technique, there is no need to repeatedly compute the same sequence expression. When the same expression is repeated, the previous computation evaluates the result.
A sequence of expressions is taken as follows:
w: x+y
x: w-z
y: x+y
z: w-z
In the above series of expressions, the second and fourth expressions compute the same results. Hence they can be written as:
w: x+y
x: w-z
y: x+y
z: x
Elimination of Dead Code
- The situation arises when the source program contains many dead codes.
- The code does not work for future consequences once declared and defined.
- Let us consider the expression a:= b + c, where b is a dead symbol and does not serve future consequences. Then b can be eliminated safely.
Renaming the Temporary Variables
Let us consider the expression a:= b+c can be renamed as d:= b+c where
a = temporary variable
d = new temporary variable
Every expression of a can be replaced by d without changing basic block optimization.
Interchanging Two Adjacent Independent Statements
Let us consider two adjacent statements
a:= b+c
d:= e+f
The values a and d are interchangeable as the two expressions are not dependent on each other.