[all-commits] [llvm/llvm-project] 2fda20: [InstCombine] Canonicalize phi order for newly ins...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Sep 27 00:56:41 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2fda200cd8c15773c640b943c28b94fcdb874646
      https://github.com/llvm/llvm-project/commit/2fda200cd8c15773c640b943c28b94fcdb874646
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-09-27 (Wed, 27 Sep 2023)

  Changed paths:
    M llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
    M llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
    M llvm/test/Transforms/InstCombine/binop-phi-operands.ll
    M llvm/test/Transforms/InstCombine/merging-multiple-stores-into-successor.ll
    M llvm/test/Transforms/InstCombine/select.ll

  Log Message:
  -----------
  [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.




More information about the All-commits mailing list