Fix for https://bugs.llvm.org/show_bug.cgi?id=44245.
The optimizeBitCastFromPhi() and FoldPHIArgOpIntoPHI() end up fighting against each other, because optimizeBitCastFromPhi() assumes that bitcasts of loads will get folded. This doesn't happen here, because a dangling phi node prevents the one-use fold in https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp#L620-L628 from triggering.
This patch fixes the issue by adding the old phis to the IC worklist, so they actually get removed (instead of this happening on the next InstCombine iteration). I'm not very familiar with the overall InstCombine design, so not sure if this is a proper fix or just a workaround.
I'm confused. Why are we replacing old LI with undef instead of NewV?
This should be explained in the comment.