[all-commits] [llvm/llvm-project] 5fe70b: Add tests for KnownBits of (and/xor/or X, (add/sub...

goldsteinn via All-commits all-commits at lists.llvm.org
Thu Feb 23 17:52:33 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5fe70be7998da1d67b463af87bc0af524a0953c6
      https://github.com/llvm/llvm-project/commit/5fe70be7998da1d67b463af87bc0af524a0953c6
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-02-23 (Thu, 23 Feb 2023)

  Changed paths:
    A llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll

  Log Message:
  -----------
  Add tests for KnownBits of (and/xor/or X, (add/sub X, OddV)); NFC

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


  Commit: 6ad6f9c57911a9e6279e4b6ef212d25e58dac112
      https://github.com/llvm/llvm-project/commit/6ad6f9c57911a9e6279e4b6ef212d25e58dac112
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-02-23 (Thu, 23 Feb 2023)

  Changed paths:
    M llvm/include/llvm/Analysis/ValueTracking.h
    M llvm/lib/Analysis/ValueTracking.cpp

  Log Message:
  -----------
  Add helper for handling `computeKnownBits` for and/xor/or; NFC

This change just factors out the existing logic for and/xor/or and
puts them in a publicly available helper.  functionality is the same.

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


  Commit: 196d3e39653c66b6809680e2ae725f7a688f672f
      https://github.com/llvm/llvm-project/commit/196d3e39653c66b6809680e2ae725f7a688f672f
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-02-23 (Thu, 23 Feb 2023)

  Changed paths:
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll

  Log Message:
  -----------
  Add logic for tracking lowbit of (and/xor/or X, (add/sub X, Odd))

Any case of logicop + add/sub(Odd) we can prove the low bit is either
zero/non-zero.

Alive2 Links:
    xor:
        sub x, C: https://alive2.llvm.org/ce/z/aaABdS
        sub C, x: https://alive2.llvm.org/ce/z/2W-ZJ7
        add C, x: https://alive2.llvm.org/ce/z/pzDkte
    or:
        sub x, C: https://alive2.llvm.org/ce/z/xd-bcP
        sub C, x: https://alive2.llvm.org/ce/z/p8hXJF
        add C, x: https://alive2.llvm.org/ce/z/osmkB6
    and:
        sub x, C: https://alive2.llvm.org/ce/z/D_NNxR
        sub C, x: https://alive2.llvm.org/ce/z/N_5C62
        add C, x: https://alive2.llvm.org/ce/z/4cy7a4

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


  Commit: 4fcfff4f2de048cdf1d2d2180534b8cf9207cebd
      https://github.com/llvm/llvm-project/commit/4fcfff4f2de048cdf1d2d2180534b8cf9207cebd
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-02-23 (Thu, 23 Feb 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
    M llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll
    M llvm/test/Analysis/ValueTracking/knownbits-bmi-pattern.ll
    M llvm/test/Transforms/InstCombine/ctpop-pow2.ll

  Log Message:
  -----------
  Use `analyzeKnownBitsFromAndXorOr` in `SimplifyDemandedUseBits` for and/xor/or

There are extra patterns that have for these three logic operations
that aren't covered in `SimplifyDemandedUseBits`. To avoid duplicating
the code, just use `analyzeKnownBitsFromAndXorOr` in
`SimplifyDemandedUseBits` to get full coverage.

Reviewed By: nikic

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


Compare: https://github.com/llvm/llvm-project/compare/058f7449cf38...4fcfff4f2de0


More information about the All-commits mailing list