Dead code can never be executed (unreachable code), and it only affects dead variables (written, but never read again), that is, irrelevant to the program. It needs to be deleted for several reasons.
- It shrinks program size
- It allows the running program to avoid executing irrelevant operations, which reduces its running time.
- It can also enable further optimizations by simplifying program structure. (avoid confusion)