[all-commits] [llvm/llvm-project] 86345e: [X86] Add tests for `isKnownToBeAPowerOfTwo`; NFC

goldsteinn via All-commits all-commits at lists.llvm.org
Tue Aug 15 23:59:36 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 86345eb45902d30d2ad5bbff8770ecb6ce2f7889
      https://github.com/llvm/llvm-project/commit/86345eb45902d30d2ad5bbff8770ecb6ce2f7889
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    A llvm/test/CodeGen/X86/known-pow2.ll

  Log Message:
  -----------
  [X86] Add tests for `isKnownToBeAPowerOfTwo`; NFC

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


  Commit: 2937d03e49be6b0942a2fcf5e3b97aa4d9678c19
      https://github.com/llvm/llvm-project/commit/2937d03e49be6b0942a2fcf5e3b97aa4d9678c19
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M llvm/test/CodeGen/X86/known-never-zero.ll

  Log Message:
  -----------
  [X86] Add more tests for `isKnownNeverZero`;

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


  Commit: ac485e40720fcdae3b1f5664143056e3dc89beb1
      https://github.com/llvm/llvm-project/commit/ac485e40720fcdae3b1f5664143056e3dc89beb1
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/X86/known-never-zero.ll

  Log Message:
  -----------
  [SelectionDAG] Add/Improve cases in `isKnownNeverZero`

1) Handle casts a bit more cleanly just with a loop rather than with
   recursion.

2) Add additional cases for smin/smax

3 ) For shifts we can also deduce non-zero if the maximum shift amount
    on the known 1s is non-zero.

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


  Commit: 2549ec18669bbae54bb41debe9efd70738db213f
      https://github.com/llvm/llvm-project/commit/2549ec18669bbae54bb41debe9efd70738db213f
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/X86/known-pow2.ll

  Log Message:
  -----------
  [SelectionDAG] Improve `isKnownToBeAPowerOfTwo`

Add additional cases for:
select, vselect, {u,s}{min,max}, and, casts, rotl, rotr

And improve handling of constants and shifts.

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


  Commit: e7f7b63fb3dd7a7d5c972b1f024a41df57c483a2
      https://github.com/llvm/llvm-project/commit/e7f7b63fb3dd7a7d5c972b1f024a41df57c483a2
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/TargetLowering.h
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.h
    M llvm/test/CodeGen/X86/known-pow2.ll

  Log Message:
  -----------
  [DAGCombiner][X86] Guard `(X & Y) ==/!= Y` --> `(X & Y) !=/== 0` behind TLI preference

On X86 for vec types `(X & Y) == Y` is generally preferable to
`(X & Y) != 0`. Creating zero requires an extra instruction and on
pre-avx512 targets there is no vector `pcmpne` so it requires two
additional instructions to invert the `pcmpeq`.

Reviewed By: RKSimon

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


  Commit: bce55fbb9bc70d6b8631d498b12986fa4e13f04e
      https://github.com/llvm/llvm-project/commit/bce55fbb9bc70d6b8631d498b12986fa4e13f04e
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    A llvm/test/Transforms/InstCombine/icmp-of-or-x.ll

  Log Message:
  -----------
  [InstCombine] Add tests for transforming `(icmp (or X, Y), X)`; NFC

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


  Commit: 3cf54c533d9fccfcf08c91c95b2891e353ff7128
      https://github.com/llvm/llvm-project/commit/3cf54c533d9fccfcf08c91c95b2891e353ff7128
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/icmp-of-or-x.ll

  Log Message:
  -----------
  [InstCombine] Add transforms for `(icmp upred (or X, Y), X)`

We can simplify ule/ugt -> eq/ne and we can remove the `Or` in some
cases of eq/ne.

`icmp (X | Y) u<= X` --> `(X | Y) == X`
    - https://alive2.llvm.org/ce/z/qnbbPv
`icmp (X | Y) u> X` --> `(X | Y) != X`
    - https://alive2.llvm.org/ce/z/fvLqg3
`icmp (X | Y) eq/ne X`
     - --> `(~X & Y) eq/ne 0` iff X is freely invertible
     - --> `(X & ~Y) eq/ne -1` iff Y is freely invertible
          - https://alive2.llvm.org/ce/z/cpPV_W

Reviewed By: nikic

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


Compare: https://github.com/llvm/llvm-project/compare/8b7b434087cc...3cf54c533d9f


More information about the All-commits mailing list