[all-commits] [llvm/llvm-project] 92a9b1: [InstCombine] Don't push operation across loop phi

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Jun 13 01:49:08 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 92a9b1c9184cbb382257ca8bf3e079ab8f20b038
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-06-13 (Mon, 13 Jun 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/cast_phi.ll

  Log Message:
  [InstCombine] Don't push operation across loop phi

When pushing an operation across a phi node, we should avoid doing
so across a loop backedge. This is generally non-profitable, because
it does not reduce the number of times the operation is executed,
and could lead to an infinite combine loop.

The code was already guarding against this, but using an
insufficiently strong condition, which did not cover the case where
the operation was originally outside the loop (in which case the
transform moves the operation from outside the loop into the loop,
which is particularly undesirable).

Differential Revision: https://reviews.llvm.org/D127499

More information about the All-commits mailing list