[all-commits] [llvm/llvm-project] 75881d: [JumpThreading] Don't phi translate past loop phi ...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Oct 31 02:20:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 75881dbb0fa5dcfe08518b6fb72621cbf60f45e2
      https://github.com/llvm/llvm-project/commit/75881dbb0fa5dcfe08518b6fb72621cbf60f45e2
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-10-31 (Tue, 31 Oct 2023)

  Changed paths:
    M llvm/lib/Transforms/Scalar/JumpThreading.cpp
    M llvm/test/Transforms/JumpThreading/pr70651.ll

  Log Message:
  -----------
  [JumpThreading] Don't phi translate past loop phi (#70664)

When evaluating comparisons in predecessors, phi operands are translated
into the predecessor. If the translation is across a backedge, this
means that the two operands of the icmp will be from two different loop
iterations, resulting in incorrect simplification.

Fix this by not performing the phi translation for phis in loop headers.

Note: This is not a complete fix. If the
jump-threading-across-loop-headers option is enabled, the LoopHeaders
variable does not get populated. Additional changes will be needed to
fix that case.

Related to https://github.com/llvm/llvm-project/issues/70651.




More information about the All-commits mailing list