[InstCombine] Canonicalize phi order for newly inserted nodes
When new phi nodes are inserted at the start of the block, the order of these does not get canonicalized, as we pick the first phi node to canonicalize towards (and the other phi nodes may have already been visited). This results in phi nodes not being deduplicated and thus a fix-point verification failure. Fix this by remembering the predecessors of the first phi node we encounter -- this will usually result in the same order we picked previously. I also considered using predecessors() order instead, but that causes substantial test fallout. Additionally the predecessors() order tends to be the reverse of the "natural" order. Fixes https://github.com/llvm/llvm-project/issues/46688.
Loading
Please sign in to comment