Instead of only detecting trivial cycles which must be a PHI with a single use that's a PHI, which in turn has a single use of the first PHI, generalize it to catch more complex cycles. This means making it look through all of its uses, as well as looking through arbitrary side-effect free instructions.
The motivation behind this is to enable InstCombiner to remove larger dead PHI cycles in one iteration, to prevent cascading iterations in some pathological cases with lots of dead PHI cycles.
Supersedes D142293
Fixes https://github.com/llvm/llvm-project/issues/50564