Reachability
Reachability is another graph property useful in optimization.
If a block/subgraph is not connected from the subgraph containing the entry block, that block is unreachable during any execution, and so is unreachable code; it can be safely removed.
If the exit block is unreachable from the entry block, it indicates an infinite loop. Not all infinite loops are detectable, of course; see Halting problem.
Dead code and some infinite loops are possible even if the programmer didn't explicitly code that way: optimizations like constant propagation and constant folding followed by jump threading could collapse multiple basic blocks into one, cause edges to be removed from a CFG, etc., thus possibly disconnecting parts of the graph.
Read more about this topic: Control Flow Graph