#
ef820632 |
| 26-Jan-2022 |
serge-sans-paille <sguelton@redhat.com> |
Rename llvm::array_lengthof into llvm::size to match std::size from C++17
As a conquence move llvm::array_lengthof from STLExtras.h to STLForwardCompat.h (which is included by STLExtras.h so no buil
Rename llvm::array_lengthof into llvm::size to match std::size from C++17
As a conquence move llvm::array_lengthof from STLExtras.h to STLForwardCompat.h (which is included by STLExtras.h so no build breakage expected).
show more ...
|
#
39e602b6 |
| 22-Jan-2022 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] try to fold binop with phi operands
This is an alternate version of D115914 that handles/tests all binary opcodes.
I suspect that we don't see these patterns too often because -simpli
[InstCombine] try to fold binop with phi operands
This is an alternate version of D115914 that handles/tests all binary opcodes.
I suspect that we don't see these patterns too often because -simplifycfg would convert the minimal cases into selects rather than leave them in phi form (note: instcombine has logic holes for combining the select patterns too though, so that's another potential patch).
We only create a new binop in a predecessor that unconditionally branches to the final block. https://alive2.llvm.org/ce/z/C57M2F https://alive2.llvm.org/ce/z/WHwAoU (not safe to speculate an sdiv for example) https://alive2.llvm.org/ce/z/rdVUvW (but it is ok on this path)
Differential Revision: https://reviews.llvm.org/D117110
show more ...
|
Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3 |
|
#
2d50630e |
| 18-Jan-2022 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] reduce code duplication; NFC
|
#
d8e0e125 |
| 18-Jan-2022 |
Daniil Kovalev <daniil@kovalev.website> |
[InstCombine] Simplify addends reordering logic
Previously some constants were not pushed to the top of the resulting expression tree as intended by the algorithm. We can remove the logic from simpl
[InstCombine] Simplify addends reordering logic
Previously some constants were not pushed to the top of the resulting expression tree as intended by the algorithm. We can remove the logic from simplifyFAdd and rely on SimplifyAssociativeOrCommutative to do that.
Differential Revision: https://reviews.llvm.org/D117302
show more ...
|
#
4cdf30d9 |
| 17-Jan-2022 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] FP with reassoc FMF: (X * C) + X --> X * (MulC + 1.0)
This fold already exists for scalars via FAddCombine (and that's why 2 of the tests are only changed cosmetically), but that code
[InstCombine] FP with reassoc FMF: (X * C) + X --> X * (MulC + 1.0)
This fold already exists for scalars via FAddCombine (and that's why 2 of the tests are only changed cosmetically), but that code misses vectors and has largely been replaced by simpler folds over time, so this is another step towards removing it.
show more ...
|
Revision tags: llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1 |
|
#
d5c002bd |
| 09-Nov-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] fix code comment to match code; NFC
|
#
2a88d00c |
| 09-Nov-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] fold sub-of-umax to 0-usubsat
Op0 - umax(X, Op0) --> 0 - usub.sat(X, Op1)
I'm not sure if this is really an improvement in IR because we probably have better recognition/analysis for
[InstCombine] fold sub-of-umax to 0-usubsat
Op0 - umax(X, Op0) --> 0 - usub.sat(X, Op1)
I'm not sure if this is really an improvement in IR because we probably have better recognition/analysis for min/max, but this lines up with the fold we do for the icmp+select idiom and removes another diff from D98152.
This is similar to the previous fold in the code that was added with: 83c2fb9f66be baa6a851308d
https://alive2.llvm.org/ce/z/5MrVB9
show more ...
|
#
baa6a851 |
| 09-Nov-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] allow commute in sub-of-umax fold
This fold was added with: 83c2fb9f66be ...but missed the commuted pattern: https://alive2.llvm.org/ce/z/_tYEGy
|
#
83c2fb9f |
| 05-Nov-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] match usub.sat from umax intrinsic
umax(X, Op1) - Op1 --> usub.sat(X, Op1)
https://alive2.llvm.org/ce/z/HpcGiJ
This happens in 2 or more steps with an icmp-select idiom instead of an
[InstCombine] match usub.sat from umax intrinsic
umax(X, Op1) - Op1 --> usub.sat(X, Op1)
https://alive2.llvm.org/ce/z/HpcGiJ
This happens in 2 or more steps with an icmp-select idiom instead of an intrinsic. This is another step towards canonicalization of the min/max intrinsics. See: D98152
show more ...
|
#
a9bceb2b |
| 30-Sep-2021 |
Jay Foad <jay.foad@amd.com> |
[APInt] Stop using soft-deprecated constructors and methods in llvm. NFC.
Stop using APInt constructors and methods that were soft-deprecated in D109483. This fixes all the uses I found in llvm, exc
[APInt] Stop using soft-deprecated constructors and methods in llvm. NFC.
Stop using APInt constructors and methods that were soft-deprecated in D109483. This fixes all the uses I found in llvm, except for the APInt unit tests which should still test the deprecated methods.
Differential Revision: https://reviews.llvm.org/D110807
show more ...
|
#
5f2f6118 |
| 03-Oct-2021 |
Dávid Bolvanský <david.bolvansky@gmail.com> |
Fixed more warnings in LLVM produced by -Wbitwise-instead-of-logical
|
Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3 |
|
#
75e8eb2b |
| 11-Sep-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] update code/test comments; NFC
Follow-up for post-commit suggestion on: 28afaed691a0a7ca46bb9f64fac11
The comments were partly copied from the original code, but not updated to match
[InstCombine] update code/test comments; NFC
Follow-up for post-commit suggestion on: 28afaed691a0a7ca46bb9f64fac11
The comments were partly copied from the original code, but not updated to match the new code.
show more ...
|
#
28afaed6 |
| 11-Sep-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] fold sub of min/max intrinsics with invertible ops
This is a translation of the existing code to handle the intrinsics and another step towards D98152.
https://alive2.llvm.org/ce/z/jA
[InstCombine] fold sub of min/max intrinsics with invertible ops
This is a translation of the existing code to handle the intrinsics and another step towards D98152.
https://alive2.llvm.org/ce/z/jA7eBC
This pattern is already handled by underlying folds if there are less uses, so the minimal tests in this case have extra uses.
The larger cmyk tests show the motivation - when combined with other folds, we invert a larger sequence and eliminate 'not' ops.
show more ...
|
Revision tags: llvmorg-13.0.0-rc2 |
|
#
cc9c545f |
| 23-Aug-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] generalize subtract with 'not' operands; 2nd try
This is a re-try of 3aa009cc87e3 which was reverted at 9577fac0fddf because it caused an infinite loop.
For the extra test case, eithe
[InstCombine] generalize subtract with 'not' operands; 2nd try
This is a re-try of 3aa009cc87e3 which was reverted at 9577fac0fddf because it caused an infinite loop.
For the extra test case, either re-ordering the transforms or adding the extra clause to avoid sub-of-sub is enough to prevent the infinite compile, but I'm doing both to be safer.
Original commit message: The motivation was to get min/max intrinsics to parity with cmp+select idioms, but this unlocks a few more folds because isFreeToInvert recognizes add/sub with constants too.
In the min/max example, we have too many extra uses for smaller folds to improve things, but this fold is able to eliminate uses even though we can't reduce the number of instructions.
show more ...
|
#
9577fac0 |
| 23-Aug-2021 |
Florian Hahn <flo@fhahn.com> |
Revert "[InstCombine] generalize subtract with 'not' operands"
This reverts commit 3aa009cc87e3789ac44bbb98b04846736373e08f.
The reverted commit causes an infinite loop in instcombine. See PR51584.
|
#
3aa009cc |
| 21-Aug-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] generalize subtract with 'not' operands
The motivation was to get min/max intrinsics to parity with cmp+select idioms, but this unlocks a few more folds because isFreeToInvert recogniz
[InstCombine] generalize subtract with 'not' operands
The motivation was to get min/max intrinsics to parity with cmp+select idioms, but this unlocks a few more folds because isFreeToInvert recognizes add/sub with constants too.
In the min/max example, we have too many extra uses for smaller folds to improve things, but this fold is able to eliminate uses even though we can't reduce the number of instructions.
show more ...
|
#
41af8f0a |
| 20-Aug-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] combine constants by reassociating add/sub/add
This may overlap partially with the reassociate pass, but it seems simple enough that we should try it here in InstCombine to enable othe
[InstCombine] combine constants by reassociating add/sub/add
This may overlap partially with the reassociate pass, but it seems simple enough that we should try it here in InstCombine to enable other folds.
This shows up as an opportunity and potential regression if we improve a subtract fold with 'not' ops to be more general.
show more ...
|
Revision tags: llvmorg-13.0.0-rc1, llvmorg-14-init |
|
#
0e15de2d |
| 17-Jul-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] fold reassociative FP add into start value of fadd reduction
This pattern is visible in unrolled and vectorized loops. Although the backend seems to be able to reassociate to ideal for
[InstCombine] fold reassociative FP add into start value of fadd reduction
This pattern is visible in unrolled and vectorized loops. Although the backend seems to be able to reassociate to ideal form in the examples I looked at, we might as well do that in IR for efficiency.
show more ...
|
Revision tags: llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2 |
|
#
d2012d96 |
| 08-Jun-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] fix nsz (fast-math) propagation from fneg-of-select
As discussed in the post-commit comments for: 3cdd05e519dd
It seems to be safe to propagate all flags from the final fneg except fo
[InstCombine] fix nsz (fast-math) propagation from fneg-of-select
As discussed in the post-commit comments for: 3cdd05e519dd
It seems to be safe to propagate all flags from the final fneg except for 'nsz' to the new select: https://alive2.llvm.org/ce/z/J_APDc
nsz has unique FMF semantics: it is not poison, it is only "insignificant" in the calculation according to the LangRef.
show more ...
|
#
4675beaa |
| 07-Jun-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] intersect nsz and ninf fast-math-flags (FMF) for fneg(fdiv) fold
https://alive2.llvm.org/ce/z/3KPvih
https://llvm.org/PR49654
|
#
519e98cd |
| 07-Jun-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] refactor match clauses; NFC
We need to adjust the FMF propagation on at least one of these transforms as discussed in: https://llvm.org/PR49654 ...so this should make it easier to inte
[InstCombine] refactor match clauses; NFC
We need to adjust the FMF propagation on at least one of these transforms as discussed in: https://llvm.org/PR49654 ...so this should make it easier to intersect flags.
show more ...
|
Revision tags: llvmorg-12.0.1-rc1 |
|
#
3cdd05e5 |
| 17-May-2021 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] fold fnegs around select
This is one of the folds requested in: https://llvm.org/PR39480
https://alive2.llvm.org/ce/z/NczU3V
Note - this uses the normal FMF propagation logic (flags
[InstCombine] fold fnegs around select
This is one of the folds requested in: https://llvm.org/PR39480
https://alive2.llvm.org/ce/z/NczU3V
Note - this uses the normal FMF propagation logic (flags transfer from the final value to new/intermediate ops). It's not clear if this matches what Alive2 implements, so we may want to adjust one or the other.
show more ...
|
#
691badc3 |
| 26-Apr-2021 |
Dávid Bolvanský <david.bolvansky@gmail.com> |
[InstCombine] C - ctpop(a) - > ctpop(~a)) if C is bitwidth (PR50104)
Proof: https://alive2.llvm.org/ce/z/mncA9K Solves https://bugs.llvm.org/show_bug.cgi?id=50104
Reviewed By: spatel
Differential
[InstCombine] C - ctpop(a) - > ctpop(~a)) if C is bitwidth (PR50104)
Proof: https://alive2.llvm.org/ce/z/mncA9K Solves https://bugs.llvm.org/show_bug.cgi?id=50104
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D101257
show more ...
|
#
d4ec8ea1 |
| 24-Apr-2021 |
Dávid Bolvanský <david.bolvansky@gmail.com> |
[InstCombine] ctpop(X) + ctpop(Y) => ctpop(X | Y) if X and Y have no common bits (PR48999)
For example:
``` int src(unsigned int a, unsigned int b) { return __builtin_popcount(a << 16) + __buil
[InstCombine] ctpop(X) + ctpop(Y) => ctpop(X | Y) if X and Y have no common bits (PR48999)
For example:
``` int src(unsigned int a, unsigned int b) { return __builtin_popcount(a << 16) + __builtin_popcount(b >> 16); }
int tgt(unsigned int a, unsigned int b) { return __builtin_popcount((a << 16) | (b >> 16)); } ```
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D101210
show more ...
|
#
9aee07ab |
| 23-Apr-2021 |
Dávid Bolvanský <david.bolvansky@gmail.com> |
[InstCombine] X - usub.sat(X, Y) => umin(X, Y)
Pattern regressed in LLVM 9 with the introduction of usub.sat.
Fixes https://bugs.llvm.org/show_bug.cgi?id=42178#c2
Reviewed By: nikic
Differential
[InstCombine] X - usub.sat(X, Y) => umin(X, Y)
Pattern regressed in LLVM 9 with the introduction of usub.sat.
Fixes https://bugs.llvm.org/show_bug.cgi?id=42178#c2
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D101184
show more ...
|