[all-commits] [llvm/llvm-project] 987148: [InstCombine] Add multiuse tests for canonicalizin...

goldsteinn via All-commits all-commits at lists.llvm.org
Wed May 29 00:38:54 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 98714866830f505d7bb87de6b92a28f280a34b9b
      https://github.com/llvm/llvm-project/commit/98714866830f505d7bb87de6b92a28f280a34b9b
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2024-05-29 (Wed, 29 May 2024)

  Changed paths:
    M llvm/test/Transforms/InstCombine/icmp-of-and-x.ll

  Log Message:
  -----------
  [InstCombine] Add multiuse tests for canonicalizing (icmp eq/ne (and x, y), {x,y}); NFC


  Commit: 5532ab17327f2887fdac739ffaaae6c341695370
      https://github.com/llvm/llvm-project/commit/5532ab17327f2887fdac739ffaaae6c341695370
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2024-05-29 (Wed, 29 May 2024)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Analysis/ValueTracking/known-power-of-two-urem.ll
    M llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v2-and-icmp-eq-to-icmp-ule.ll
    M llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v2-and-icmp-ne-to-icmp-ugt.ll
    M llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v3-and-icmp-eq-to-icmp-ule.ll
    M llvm/test/Transforms/InstCombine/canonicalize-low-bit-mask-v3-and-icmp-ne-to-icmp-ugt.ll
    M llvm/test/Transforms/InstCombine/icmp-and-lowbit-mask.ll
    M llvm/test/Transforms/InstCombine/icmp-of-and-x.ll

  Log Message:
  -----------
  [InstCombine] Make the `(icmp eq/ne (and X, Y), X)` canonicalization work for non-const operands

We currently do:
    `(icmp eq/ne (and X, Y), Y)` -> `(icmp eq/ne (and ~X, Y), 0)`
if `X` is constant. We can make this more general and do it if `X` is
freely invertable (i.e say `X = ~Z`).

As well, we can also do:
    `(icmp eq/ne (and X, Y), Y)` -> `(icmp eq/ne (or X, ~Y), -1)`
If `Y` is freely invertible.

Proofs: https://alive2.llvm.org/ce/z/yeWH3E

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

Closes #84688


Compare: https://github.com/llvm/llvm-project/compare/2cfea14a57ad...5532ab17327f

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list