[all-commits] [llvm/llvm-project] cf47af: [InstCombine] Generalize folds for inversion of ic...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Dec 8 02:25:54 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cf47af493b1288b453a77a4b66959c6ee7a85c34
      https://github.com/llvm/llvm-project/commit/cf47af493b1288b453a77a4b66959c6ee7a85c34
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-12-08 (Fri, 08 Dec 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll
    M llvm/test/Transforms/InstCombine/icmp-uge-of-not-of-shl-allones-by-bits-and-val-to-icmp-eq-of-lshr-val-by-bits-and-0.ll
    M llvm/test/Transforms/InstCombine/icmp-ult-of-not-of-shl-allones-by-bits-and-val-to-icmp-ne-of-lshr-val-by-bits-and-0.ll
    M llvm/test/Transforms/InstCombine/not.ll
    M llvm/test/Transforms/PhaseOrdering/X86/vdiv.ll

  Log Message:
  -----------
  [InstCombine] Generalize folds for inversion of icmp operands (#74317)

We have a bunch of folds that basically perform X pred Y to ~Y pred ~X
for various special cases where this saves an instruction.

Generalize these folds to use isFreeToInvert(). We have to make sure
that we consume an instruction in either of the inversions, otherwise
we're just going to swap the icmp back and forth.

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




More information about the All-commits mailing list