[all-commits] [llvm/llvm-project] 58c9ad: [DAGCombiner] Add bswap(logic_op(bswap(x), y)) reg...
goldsteinn via All-commits
all-commits at lists.llvm.org
Tue May 16 16:58:41 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 58c9ad9c85a579207fedab8815e4e071e3a13cbd
https://github.com/llvm/llvm-project/commit/58c9ad9c85a579207fedab8815e4e071e3a13cbd
Author: Austin Chang <austin880625 at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
A llvm/test/CodeGen/ARM/combine-bitreverse.ll
A llvm/test/CodeGen/ARM/combine-bswap.ll
M llvm/test/CodeGen/X86/combine-bitreverse.ll
M llvm/test/CodeGen/X86/combine-bswap.ll
Log Message:
-----------
[DAGCombiner] Add bswap(logic_op(bswap(x), y)) regression test case; NFC
Fold the following case on SelectionDAG combiner
This patch includes the regression test cases
```
bswap(logic_op(x, bswap(y))) -> logic_op(bswap(x), y)
bswap(logic_op(bswap(x), y)) -> logic_op(x, bswap(y))
bswap(logic_op(bswap(x), bswap(y))) -> logic_op(x, y) (with multiuse)
```
Reviewed By: goldstein.w.n
Differential Revision: https://reviews.llvm.org/D149782
Commit: d069ac035add3095c771f49540223f98e5ba10b9
https://github.com/llvm/llvm-project/commit/d069ac035add3095c771f49540223f98e5ba10b9
Author: Austin Chang <austin880625 at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
M llvm/test/CodeGen/ARM/combine-bswap.ll
M llvm/test/CodeGen/X86/combine-bswap.ll
Log Message:
-----------
[DAGCombiner] Add bswap(logic_op(bswap(x), y)) optimization
This is the implementation of D149782
The patch implements a helper function that matches and fold the following cases in the DAGCombiner:
1. `bswap(logic_op(x, bswap(y))) -> logic_op(bswap(x), y)`
2. `bswap(logic_op(bswap(x), y)) -> logic_op(x, bswap(y))`
3. `bswap(logic_op(bswap(x), bswap(y))) -> logic_op(x, y)` in multiuse case, which still reduces the number of instructions.
The helper function accepts SDValue with BSWAP and BITREVERSE opcode. This patch folds the BSWAP cases and remain the BITREVERSE optimization in the future
Reviewed By: RKSimon, goldstein.w.n
Differential Revision: https://reviews.llvm.org/D149783
Commit: 2b346a138d40b1a325a58ca9fa9d4ce3b3b0cf78
https://github.com/llvm/llvm-project/commit/2b346a138d40b1a325a58ca9fa9d4ce3b3b0cf78
Author: Austin Chang <austin880625 at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
M llvm/test/Transforms/InstCombine/bswap-fold.ll
Log Message:
-----------
Recommit "[InstCombine] Improve bswap optimization" (2nd try)
Issue was an assertion failure due to an unchecked `cast`. Fix is to
check the operator is `BinaryOperator` before cast so that we won't
match `ConstExpr`
Reviewed By: goldstein.w.n, RKSimon
Differential Revision: https://reviews.llvm.org/D149699
Commit: 7f82f108c2ec08636224dd0b58fe7e9021852002
https://github.com/llvm/llvm-project/commit/7f82f108c2ec08636224dd0b58fe7e9021852002
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
M llvm/test/Analysis/ValueTracking/known-non-zero.ll
Log Message:
-----------
[ValueTracking] Add tests for deducing `X * Y != 0` if `LSB(X) * LSB(Y) != 0`; NFC
Differential Revision: https://reviews.llvm.org/D150424
Commit: 774ecc20e121e238099ef5ef8efad3ed062a4ae5
https://github.com/llvm/llvm-project/commit/774ecc20e121e238099ef5ef8efad3ed062a4ae5
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
M llvm/lib/Analysis/ValueTracking.cpp
M llvm/test/Analysis/ValueTracking/known-non-zero.ll
Log Message:
-----------
[ValueTracking] deduce `X * Y != 0` if `LowestKnownBit(X) * LowestKnownBit(Y) != 0`
For `X * Y`, if there exists a subset of `X` and subset of `Y` s.t `sX * sY != 0`,
then `X * Y != 0`.
- See first proof: https://alive2.llvm.org/ce/z/28C9CG
- NB: This is why the previous Odd case works.
In knownbits we could exhaustively hunt for such a subset, but
`LSB(X)` and `LSB(Y)` actually works. If `LSB(X) * LSB(Y) != 0`, then
`X * Y != 0`
- See proof: https://alive2.llvm.org/ce/z/p5wWid
In `isKnownNonZero` we can use this as if the `LowestKnownOne(X) *
LowestKnownOne(Y) != 0`, then `X * Y != 0`, and we don't need to try
and other subsets.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D150425
Commit: 53a079c8f723ca6a33c76a4818d47a66fd65ca38
https://github.com/llvm/llvm-project/commit/53a079c8f723ca6a33c76a4818d47a66fd65ca38
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
A llvm/test/Analysis/ValueTracking/knownbits-div.ll
Log Message:
-----------
[ValueTracking] Add tests for knownbits of `sdiv` and `udiv`; NFC
Differential Revision: https://reviews.llvm.org/D150092
Commit: 8c569c922bc5bbe9fb67ff3ff3ac28e17b012360
https://github.com/llvm/llvm-project/commit/8c569c922bc5bbe9fb67ff3ff3ac28e17b012360
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
M llvm/include/llvm/Support/KnownBits.h
M llvm/lib/Support/KnownBits.cpp
M llvm/unittests/Support/KnownBitsTest.cpp
Log Message:
-----------
[KnownBits] Add implementation for `KnownBits::sdiv`
Can figure out some of the upper bits (similiar to `udiv`) if we know
the sign of the inputs.
As well, if we have the `exact` flag we can sometimes determine some
low-bits.
Differential Revision: https://reviews.llvm.org/D150093
Commit: 7d05ab99edb9f5ef06c3d635afcd22502866f447
https://github.com/llvm/llvm-project/commit/7d05ab99edb9f5ef06c3d635afcd22502866f447
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
M llvm/include/llvm/Support/KnownBits.h
M llvm/lib/Support/KnownBits.cpp
M llvm/test/Analysis/ValueTracking/knownbits-div.ll
M llvm/unittests/Support/KnownBitsTest.cpp
Log Message:
-----------
[KnownBits] Improve `KnownBits::udiv`
We can more precisely determine the upper bits doing `MaxNum /
MinDenum` as opposed to only using the MSB.
As well, if the `exact` flag is set, we can sometimes determine some
of the low-bits.
Differential Revision: https://reviews.llvm.org/D150094
Commit: 99795afb28af4a93e128597b47579e05da2340b3
https://github.com/llvm/llvm-project/commit/99795afb28af4a93e128597b47579e05da2340b3
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
M llvm/lib/Analysis/ValueTracking.cpp
M llvm/test/Analysis/ValueTracking/knownbits-div.ll
Log Message:
-----------
[ValueTracking] Pass `exact` flag to `KnownBits::udiv` in `computeKnownBits`
This information was previously missing but we can use it for
determining the low-bits.
Differential Revision: https://reviews.llvm.org/D150095
Commit: 124547eae8a610a9a77fe3e219e9cd98a2580cfe
https://github.com/llvm/llvm-project/commit/124547eae8a610a9a77fe3e219e9cd98a2580cfe
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
M llvm/lib/Analysis/ValueTracking.cpp
M llvm/test/Analysis/ValueTracking/knownbits-div.ll
Log Message:
-----------
[ValueTracking] Use `KnownBits::sdiv` for `sdiv` opcode in `computeKnownBits`
We now of an implementation of `KnownBits::sdiv` so we can implement
this case.
Differential Revision: https://reviews.llvm.org/D150096
Commit: 3b2a217a47b015f28c838418395912db5ed11bc8
https://github.com/llvm/llvm-project/commit/3b2a217a47b015f28c838418395912db5ed11bc8
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
A llvm/test/CodeGen/X86/knownbits-div.ll
Log Message:
-----------
[X86] Add tests for `computeKnownBits` of `sdiv` and `udiv`; NFC
Differential Revision: https://reviews.llvm.org/D150097
Commit: d294e3cb763abd33fcabf1e3642cb6659fd304cf
https://github.com/llvm/llvm-project/commit/d294e3cb763abd33fcabf1e3642cb6659fd304cf
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
M llvm/test/CodeGen/ARM/select-imm.ll
M llvm/test/CodeGen/X86/knownbits-div.ll
Log Message:
-----------
[SelectionDAG] Improve `computeKnownBits` implementations of `sdiv` and `udiv`
Add `exact` flag handling for `udiv` and add entire `sdiv` case.
Differential Revision: https://reviews.llvm.org/D150098
Commit: 261e5d0951ef15fea4db96f3c9c6080af9548239
https://github.com/llvm/llvm-project/commit/261e5d0951ef15fea4db96f3c9c6080af9548239
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
A llvm/test/Analysis/ValueTracking/knownbits-abs.ll
Log Message:
-----------
[ValueTracking] Add tests for knownbits of `abs`; NFC
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D150099
Compare: https://github.com/llvm/llvm-project/compare/1fb99dedd711...261e5d0951ef
More information about the All-commits
mailing list