[all-commits] [llvm/llvm-project] a6c022: [InstCombine] Add tests for transforming `(add (sh...

goldsteinn via All-commits all-commits at lists.llvm.org
Wed Aug 16 20:41:49 PDT 2023


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

  Changed paths:
    A llvm/test/Transforms/InstCombine/add-shift.ll

  Log Message:
  -----------
  [InstCombine] Add tests for transforming `(add (shl (neg X), Cnt))`; NFC

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


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

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/add-shift.ll

  Log Message:
  -----------
  [InstCombine] Transform `(add (shl (neg X), Cnt))` -> `(sub (shl X, Cnt))`

Just a simple instruction save.

Proof: https://alive2.llvm.org/ce/z/Vb484j

Reviewed By: nikic

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


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

  Changed paths:
    M llvm/test/Transforms/Inline/nonnull.ll

  Log Message:
  -----------
  [Inliner] Add more tests for deducing return attributes of callsites when inlining; NFC

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


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

  Changed paths:
    M llvm/lib/Transforms/Utils/InlineFunction.cpp
    M llvm/test/Transforms/Inline/nonnull.ll

  Log Message:
  -----------
  [Inliner] Add the callsites called function return attributes to set addable attributes

We can do this by just querying attribute in the callsite itself. This
is both cleaner code and produces bette results.

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


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

  Changed paths:
    M llvm/lib/Transforms/Utils/InlineFunction.cpp
    M llvm/test/Transforms/Inline/nonnull.ll

  Log Message:
  -----------
  [Inliner] Add return attributes to callsites not marked `willreturn`/`nounwind`

The actual callsite we are adding to doesn't need to be
`willreturn`/`nounwind`, only ever instructions between the callsite
and the return.

Reviewed By: nikic

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


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

  Changed paths:
    M llvm/test/Transforms/InstCombine/select-with-bitwise-ops.ll

  Log Message:
  -----------
  [InstCombine] Add tests for (select (icmp x, Cp2_0), (binop y, Cp2_1), y); NFC

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


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

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

  Log Message:
  -----------
  [InstCombine] Cleanup code in foldSelectICmpAndOr; NFC

There was just alot of boolean logic to propegate conditions that seem
clearer in conditions.

Reviewed By: nikic

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


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

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-with-bitwise-ops.ll

  Log Message:
  -----------
  [InstCombine] Remove requirement on `trunc` in `slt/sgt` case in `foldSelectICmpAndOr`

AFAICT, the trunc is not needed for correctness/performance and just
blocks what should be handlable cases.

Reviewed By: nikic

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


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

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

  Log Message:
  -----------
  [InstCombine] Refactor foldSelectICmpAndOr to use `decomposeBitTestICmp` instead of bespoke logic

This is essentially NFC as the cases `decomposeBitTestICmp` covers
that weren't already covered explicitly, will be canonicalized into
the cases explicitly covered. As well the unsigned cases don't apply
as the `Mask` is not a power of 2.

That being said, using a well established helper is less bug prone and
if some canonicalization changes, will prevent regressions here.

Reviewed By: nikic

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


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

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-with-bitwise-ops.ll

  Log Message:
  -----------
  [InstCombine] Expand `foldSelectICmpAndOr` -> `foldSelectICmpAndBinOp` to work for more binops

This just expands on the existing logic that worked for `Or` and
applies it to any binop where `0` is the identity value on the RHS
i.e: `add`, `or`, `xor`, `shl`, etc...

Proofs For Some: https://alive2.llvm.org/ce/z/XZo6JD

Reviewed By: nikic

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


Compare: https://github.com/llvm/llvm-project/compare/463e7cb89278...d3402bc4460a


More information about the All-commits mailing list