Dead-code elimination is an optimization technique that removes code that never gets executed, helping to streamline the program and improve efficiency.
Consider the following simple code:
int compute(int a, int b) {
int result = a + b;
int unused = a * b; // This is dead code if 'unused' is never utilized
return result;
}
In the above example, if the variable unused is never read or used, the computation a * b is considered dead code and can be eliminated.