[all-commits] [llvm/llvm-project] 3d199d: [InstSimplify] Make simplifyWithOpReplaced() recur...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Jul 14 07:33:58 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3d199d086e076f0b9b90d4c59f2226a417a639b5
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-07-14 (Fri, 14 Jul 2023)

  Changed paths:
    M llvm/lib/Analysis/InstructionSimplify.cpp
    M llvm/test/Transforms/InstCombine/div-by-0-guard-before-smul_ov-not.ll
    M llvm/test/Transforms/InstCombine/div-by-0-guard-before-umul_ov-not.ll
    M llvm/test/Transforms/InstCombine/select-ctlz-to-cttz.ll
    M llvm/test/Transforms/InstCombine/shift.ll
    M llvm/test/Transforms/InstSimplify/select.ll

  Log Message:
  [InstSimplify] Make simplifyWithOpReplaced() recursive (PR63104)

Support replacement of operands not only in the immediate
instruction, but also instructions it uses.

To the most part, this extension is straightforward, but there are
two bits worth highlighting:

First, we can now no longer assume that if the Op is a vector, the
instruction also returns a vector. If Op is a vector and the
instruction returns a scalar, we should consider it as a cross-lane

Second, for the x ^ x special case, we can no longer assume that
the operand is RepOp, as we might have a replacement higher up the
instruction chain.

There is one optimization regression, but it is in a fuzzer-generated
test case.

Fixes https://github.com/llvm/llvm-project/issues/63104.

More information about the All-commits mailing list