[all-commits] [llvm/llvm-project] 0e6e55: [NFC][SCEV] Add some tests with logical operations...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Thu Feb 10 06:47:02 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0e6e559bf76d374e6d4c1a56a6b87ddb56c01cfe
      https://github.com/llvm/llvm-project/commit/0e6e559bf76d374e6d4c1a56a6b87ddb56c01cfe
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    A llvm/test/Analysis/ScalarEvolution/logical-operations.ll

  Log Message:
  -----------
  [NFC][SCEV] Add some tests with logical operations and whatnot


  Commit: e7e0834f076afaf3cde2c6c7270821084389dff8
      https://github.com/llvm/llvm-project/commit/e7e0834f076afaf3cde2c6c7270821084389dff8
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/exact-exit-count-more-precise.ll
    M llvm/test/Analysis/ScalarEvolution/logical-operations.ll
    M llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
    M llvm/test/Analysis/ScalarEvolution/pr48225.ll

  Log Message:
  -----------
  [SCEV] Recognize binary `or` as bit-wise `umax`

https://alive2.llvm.org/ce/z/SMEaoc

We could transparently handle wider bitwidths,
by effectively casting iN to <N x i1> and performing the `umax`
bit/element -wise, the expression will be rather large,
so let's not do that for now.


  Commit: 503541fa93533920acd29ed86d46deae48546ce6
      https://github.com/llvm/llvm-project/commit/503541fa93533920acd29ed86d46deae48546ce6
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/exact-exit-count-more-precise.ll
    M llvm/test/Analysis/ScalarEvolution/logical-operations.ll
    M llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
    M llvm/test/Analysis/ScalarEvolution/pr48225.ll
    M llvm/test/Analysis/ScalarEvolution/umin-umax-folds.ll
    M llvm/test/Analysis/ScalarEvolution/widenable-condition.ll

  Log Message:
  -----------
  [SCEV] Recognize binary `and` as bit-wise `umin`

https://alive2.llvm.org/ce/z/aKAr94

We could transparently handle wider bitwidths,
by effectively casting iN to <N x i1> and performing the `umin`
bit/element -wise, the expression will be rather large,
so let's not do that for now.


  Commit: 73990ff8a76feed51a0fa89ddeda9e33b7e45f13
      https://github.com/llvm/llvm-project/commit/73990ff8a76feed51a0fa89ddeda9e33b7e45f13
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/logical-operations.ll

  Log Message:
  -----------
  [SCEV] Recognize binary `xor` as bit-wise `add`

https://alive2.llvm.org/ce/z/ULuZxB

We could transparently handle wider bitwidths,
by effectively casting iN to <N x i1> and performing the `add`
bit/element -wise, the expression will be rather large,
so let's not do that for now.


  Commit: 97930f85afe63191a1edf8a3141aabdafcbc6847
      https://github.com/llvm/llvm-project/commit/97930f85afe63191a1edf8a3141aabdafcbc6847
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

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

  Log Message:
  -----------
  [NFC][SCEV] Prepare `createNodeForSelectOrPHI()` for gaining additional strategy

Currently `createNodeForSelectOrPHI()` takes an Instruction,
and only works on the Cond that is an ICmpInst,
but that can be relaxed somewhat.

For now, simply rename the existing function,
and add a thin wrapper ontop that still does
the same thing as it used to.


  Commit: 1c69444863f3d8170cd9931c19283fe44d85a2e7
      https://github.com/llvm/llvm-project/commit/1c69444863f3d8170cd9931c19283fe44d85a2e7
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp

  Log Message:
  -----------
  [SCEV] `createNodeForSelectOrPHI()`: try constant-folding even if not an Instruction

We'd catch the tautological select pattern later anyways
due to constant folding, so that leaves PHI-like select,
but it does not appear to fire there.


  Commit: 16bc24e7be90f32056a1915d8c57adf1478384e0
      https://github.com/llvm/llvm-project/commit/16bc24e7be90f32056a1915d8c57adf1478384e0
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/ScalarEvolution.h
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll
    M llvm/test/Analysis/ScalarEvolution/exit-count-select.ll
    M llvm/test/Analysis/ScalarEvolution/logical-operations.ll

  Log Message:
  -----------
  [SCEV] Recognize logical `and` as `umin_seq`

By definition, `umin_seq` has the exact same
poison stopping properties the original `select` had:
https://alive2.llvm.org/ce/z/59KuZZ


  Commit: 49d9acc2426f2aae9d8266c9800eaf123101c351
      https://github.com/llvm/llvm-project/commit/49d9acc2426f2aae9d8266c9800eaf123101c351
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll
    M llvm/test/Analysis/ScalarEvolution/exit-count-select.ll
    M llvm/test/Analysis/ScalarEvolution/logical-operations.ll

  Log Message:
  -----------
  [SCEV] Recognize logical `or` as `not umin_seq (not, not)`

By definition, `umin_seq` has the exact same
poison stopping properties the original `select` had:
https://alive2.llvm.org/ce/z/MUfbTL


  Commit: 418604fd90a2344066256bed1a9fb47085473546
      https://github.com/llvm/llvm-project/commit/418604fd90a2344066256bed1a9fb47085473546
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/logical-operations.ll

  Log Message:
  -----------
  [SCEV] Recognize `cond ? i1 x : i1 1` as `~umin_seq cond, ~x`

By definition, `umin_seq` has the exact same
poison stopping properties the original `select` had:
https://alive2.llvm.org/ce/z/aqe9GK


  Commit: 9766a0cca00408712fa9a3ed4d2ef319f8e30385
      https://github.com/llvm/llvm-project/commit/9766a0cca00408712fa9a3ed4d2ef319f8e30385
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/logical-operations.ll

  Log Message:
  -----------
  [SCEV] Recognize `cond ? i1 0 : i1 y` as `umin_seq ~cond, x`

By definition, `umin_seq` has the exact same
poison stopping properties the original `select` had:
https://alive2.llvm.org/ce/z/N6XwV-


  Commit: 576a45f20d015de54f99bed5719536adfa0e7738
      https://github.com/llvm/llvm-project/commit/576a45f20d015de54f99bed5719536adfa0e7738
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp

  Log Message:
  -----------
  [NFC][SCEV] `createNodeForSelectOrPHIViaUMinSeq()`: refactor `i1 cond ? i1 x : i1 C` pattern

https://alive2.llvm.org/ce/z/2Q7Du_


  Commit: 9a322e430f57b9e640c8db403dc443ffcf6d4584
      https://github.com/llvm/llvm-project/commit/9a322e430f57b9e640c8db403dc443ffcf6d4584
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp

  Log Message:
  -----------
  [NFC][SCEV] `createNodeForSelectOrPHIViaUMinSeq()`: refactor `i1 cond ? i1 C : i1 y` pattern

https://alive2.llvm.org/ce/z/uRvVtN


  Commit: 580d3a14b2a716f31f4e4bccdb7dce4f09c7c3b7
      https://github.com/llvm/llvm-project/commit/580d3a14b2a716f31f4e4bccdb7dce4f09c7c3b7
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-10 (Thu, 10 Feb 2022)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp

  Log Message:
  -----------
  [NFC][SCEV] `createNodeForSelectOrPHIViaUMinSeq()`: refactor `i1 cond ? i1 x : i1 y` handling

While that effectively concludes i1 select handling,
that boolean restriction can be lifted later.


Compare: https://github.com/llvm/llvm-project/compare/c58be8572001...580d3a14b2a7


More information about the All-commits mailing list