Explain briefly Dead code Elimination of the commonly used code optimization techniques
Dead code Elimination:
Code which is unreachable or which does not influence the program (for example dead stores) can be removed. In the illustration below, the value assigned to i is never utilized, and the dead store can be removed. The first assignment to global is dead, and the third assignment to global is not reachable; both can be removed.
int global; void f (){ int i;
i = 1; /* dead store */
global = 1; /* dead store */
global = 2;
return;
global = 3; /* unreachable */}
Below is the code fragment after dead code elimination.
int global;
void f (){ global = 2; return;}