Switch simplification could sometimes fail to notice when an
intermediate case removal caused the switch condition to become
constant. This would cause the switch to be simplified into a
conditional branch rather than a direct branch.
Most of the time this didn't matter, except that occasionally
downstream parts of SimplifyCFG expect tautological branches to
already have been eliminated. The missed handling in switch
simplification would cause an assertion failure in the downstream
code.
Triggering the assertion failure is fairly sensitive to the exact
order of various simplifications.
I think this may cause problems if we have the following case: We have a case 1 => foo, case 2 => default, then removing default folds CI to 1, but at this point we have already visited case 1, so TheOnlyDest will remain nullptr, and we'll set it to the default destination below, which would be the wrong one in that case.