#
a36bb7fd |
| 11-Apr-2021 |
Roman Lebedev <lebedev.ri@gmail.com> |
[InstCombine] (X | Op01C) + Op1C --> X + (Op01C + Op1C) iff the or is actually an add
https://alive2.llvm.org/ce/z/Coc5yf
|
#
24f67473 |
| 07-Apr-2021 |
Roman Lebedev <lebedev.ri@gmail.com> |
[InstCombine] foldAddWithConstant(): don't deal with non-immediate constants
All of the code that handles general constant here (other than the more restrictive APInt-dealing code) expects that it i
[InstCombine] foldAddWithConstant(): don't deal with non-immediate constants
All of the code that handles general constant here (other than the more restrictive APInt-dealing code) expects that it is an immediate, because otherwise we won't actually fold the constants, and increase instruction count. And it isn't obvious why we'd be okay with increasing the number of constant expressions, those still will have to be run..
But after 2829094a8e252d04f13aabdf6f416c42a06af695 this could also cause endless combine loops. So actually properly restrict this code to immediates.
show more ...
|
#
2829094a |
| 07-Apr-2021 |
Roman Lebedev <lebedev.ri@gmail.com> |
Reland [InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)
This reverts commit a547b4e26b311e417cd51100e379693f51a3f448, relanding commit 31d219d2997fed1b7dc97e0adf170d5aaf65883e, which wa
Reland [InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)
This reverts commit a547b4e26b311e417cd51100e379693f51a3f448, relanding commit 31d219d2997fed1b7dc97e0adf170d5aaf65883e, which was reverted because there was a conflicting inverse transform, which was causing an endless combine loop, which has now been adjusted.
Original commit message:
https://alive2.llvm.org/ce/z/67w-wQ
We prefer `add`s over `sub`, and this particular xform allows further folds to happen:
Fixes https://bugs.llvm.org/show_bug.cgi?id=49858
show more ...
|
#
93d1d94b |
| 07-Apr-2021 |
Roman Lebedev <lebedev.ri@gmail.com> |
[InstCombine] Restrict "C-(X+C2) --> (C-C2)-X" fold to immediate constants
I.e., if any/all of the consants is an expression, don't do it. Since those constants won't reduce into an immediate, but w
[InstCombine] Restrict "C-(X+C2) --> (C-C2)-X" fold to immediate constants
I.e., if any/all of the consants is an expression, don't do it. Since those constants won't reduce into an immediate, but would be left as an constant expression, they could cause endless combine loops after 31d219d2997fed1b7dc97e0adf170d5aaf65883e added an inverse transformation.
show more ...
|
#
a547b4e2 |
| 07-Apr-2021 |
Petr Hosek <phosek@google.com> |
Revert "[InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)"
This reverts commit 31d219d2997fed1b7dc97e0adf170d5aaf65883e which causes an infinite loop when compiling the XRay runtime.
|
Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5 |
|
#
31d219d2 |
| 06-Apr-2021 |
Roman Lebedev <lebedev.ri@gmail.com> |
[InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)
https://alive2.llvm.org/ce/z/67w-wQ
We prefer `add`s over `sub`, and this particular xform allows further folds to happen:
Fixes https
[InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)
https://alive2.llvm.org/ce/z/67w-wQ
We prefer `add`s over `sub`, and this particular xform allows further folds to happen:
Fixes https://bugs.llvm.org/show_bug.cgi?id=49858
show more ...
|
Revision tags: llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1 |
|
#
ae69fa9b |
| 31-Dec-2020 |
Dávid Bolvanský <david.bolvansky@gmail.com> |
[InstCombine] Transform (A + B) - (A & B) to A | B (PR48604)
define i32 @src(i32 %x, i32 %y) { %0: %a = add i32 %x, %y %o = and i32 %x, %y %r = sub i32 %a, %o ret i32 %r } => define i32 @tgt
[InstCombine] Transform (A + B) - (A & B) to A | B (PR48604)
define i32 @src(i32 %x, i32 %y) { %0: %a = add i32 %x, %y %o = and i32 %x, %y %r = sub i32 %a, %o ret i32 %r } => define i32 @tgt(i32 %x, i32 %y) { %0: %b = or i32 %x, %y ret i32 %b } Transformation seems to be correct!
https://alive2.llvm.org/ce/z/2fhW6r
show more ...
|
#
742ea77c |
| 31-Dec-2020 |
Dávid Bolvanský <david.bolvansky@gmail.com> |
[InstCombine] Transform (A + B) - (A | B) to A & B (PR48604)
define i32 @src(i32 %x, i32 %y) { %0: %a = add i32 %x, %y %o = or i32 %x, %y %r = sub i32 %a, %o ret i32 %r } => define i32 @tgt(
[InstCombine] Transform (A + B) - (A | B) to A & B (PR48604)
define i32 @src(i32 %x, i32 %y) { %0: %a = add i32 %x, %y %o = or i32 %x, %y %r = sub i32 %a, %o ret i32 %r } => define i32 @tgt(i32 %x, i32 %y) { %0: %b = and i32 %x, %y ret i32 %b } Transformation seems to be correct!
https://alive2.llvm.org/ce/z/aQRh2j
show more ...
|
#
b3021a72 |
| 24-Dec-2020 |
Roman Lebedev <lebedev.ri@gmail.com> |
[IR][InstCombine] Add m_ImmConstant(), that matches on non-ConstantExpr constants, and use it
A pattern to ignore ConstantExpr's is quite common, since they frequently lead into infinite combine loo
[IR][InstCombine] Add m_ImmConstant(), that matches on non-ConstantExpr constants, and use it
A pattern to ignore ConstantExpr's is quite common, since they frequently lead into infinite combine loops, so let's make writing it easier.
show more ...
|
Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2 |
|
#
d2ed9d6b |
| 15-Dec-2020 |
Reid Kleckner <rnk@google.com> |
Revert "ADT: Migrate users of AlignedCharArrayUnion to std::aligned_union_t, NFC"
We determined that the MSVC implementation of std::aligned* isn't suited to our needs. It doesn't support 16 byte al
Revert "ADT: Migrate users of AlignedCharArrayUnion to std::aligned_union_t, NFC"
We determined that the MSVC implementation of std::aligned* isn't suited to our needs. It doesn't support 16 byte alignment or higher, and it doesn't really guarantee 8 byte alignment. See https://github.com/microsoft/STL/issues/1533
Also reverts "ADT: Change AlignedCharArrayUnion to an alias of std::aligned_union_t, NFC"
Also reverts "ADT: Remove AlignedCharArrayUnion, NFC" to bring back AlignedCharArrayUnion.
This reverts commit 4d8bf870a82765eb0d4fe53c82f796b957c05954.
This reverts commit d10f9863a5ac1cb681af07719650c44b48f289ce.
This reverts commit 4b5dc150b9862271720b3d56a3e723a55dd81838.
show more ...
|
#
d10f9863 |
| 02-Dec-2020 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
ADT: Migrate users of AlignedCharArrayUnion to std::aligned_union_t, NFC
Prepare to delete `AlignedCharArrayUnion` by migrating its users over to `std::aligned_union_t`.
I will delete `AlignedCharA
ADT: Migrate users of AlignedCharArrayUnion to std::aligned_union_t, NFC
Prepare to delete `AlignedCharArrayUnion` by migrating its users over to `std::aligned_union_t`.
I will delete `AlignedCharArrayUnion` and its tests in a follow-up commit so that it's easier to revert in isolation in case some downstream wants to keep using it.
Differential Revision: https://reviews.llvm.org/D92516
show more ...
|
#
5b267fb7 |
| 02-Dec-2020 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
ADT: Stop peeking inside AlignedCharArrayUnion, NFC
Update all the users of `AlignedCharArrayUnion` to stop peeking inside (to look at `buffer`) so that a follow-up patch can replace it with an alia
ADT: Stop peeking inside AlignedCharArrayUnion, NFC
Update all the users of `AlignedCharArrayUnion` to stop peeking inside (to look at `buffer`) so that a follow-up patch can replace it with an alias to `std::aligned_union_t`.
This was reviewed as part of https://reviews.llvm.org/D92512, but I'm splitting this bit out to commit first to reduce churn in case the change to `AlignedCharArrayUnion` needs to be reverted for some unexpected reason.
show more ...
|
Revision tags: llvmorg-11.0.1-rc1 |
|
#
678b9c5d |
| 24-Nov-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] try difference-of-shifts factorization before negator
We need to preserve wrapping flags to allow better folds. The cases with geps may be non-intuitive, but that appears to agree with
[InstCombine] try difference-of-shifts factorization before negator
We need to preserve wrapping flags to allow better folds. The cases with geps may be non-intuitive, but that appears to agree with Alive2: https://alive2.llvm.org/ce/z/JQcqw7 We create 'nsw' ops independent from the original wrapping on the sub.
show more ...
|
#
ab29f091 |
| 23-Nov-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] propagate 'nsw' on pointer difference of 'inbounds' geps
This is a retry of 324a53205. I cautiously reverted that at 6aa3fc4 because the rules about gep math were not clear. Since then
[InstCombine] propagate 'nsw' on pointer difference of 'inbounds' geps
This is a retry of 324a53205. I cautiously reverted that at 6aa3fc4 because the rules about gep math were not clear. Since then, we have added this line to LangRef for gep inbounds: "The successive addition of offsets (without adding the base address) does not wrap the pointer index type in a signed sense (nsw)."
See D90708 and post-commit comments on the revert patch for more details.
show more ...
|
#
02dda1c6 |
| 04-Nov-2020 |
Nikita Popov <nikita.ppv@gmail.com> |
[Local] Clean up EmitGEPOffset
Handle the emission of the add in a single place, instead of three different ones.
Don't emit an unnecessary add with zero to start with. It will get dropped by InstC
[Local] Clean up EmitGEPOffset
Handle the emission of the add in a single place, instead of three different ones.
Don't emit an unnecessary add with zero to start with. It will get dropped by InstCombine, but we may as well not create it in the first place. This also means that InstCombine does not need to specially handle this extra add.
This is conceptually NFC, but can affect worklist order etc.
show more ...
|
#
0abde4bc |
| 13-Nov-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] fold sub of low-bit masked value from offset of same value
There might be some demanded/known bits way to generalize this, but I'm not seeing it right now.
This came up as a regressio
[InstCombine] fold sub of low-bit masked value from offset of same value
There might be some demanded/known bits way to generalize this, but I'm not seeing it right now.
This came up as a regression when I was looking at a different demanded bits improvement.
https://rise4fun.com/Alive/5fl
Name: general Pre: ((-1 << countTrailingZeros(C1)) & C2) == 0 %a1 = add i8 %x, C1 %a2 = and i8 %x, C2 %r = sub i8 %a1, %a2 => %r = and i8 %a1, ~C2
Name: test 1 %a1 = add i8 %x, 192 %a2 = and i8 %x, 10 %r = sub i8 %a1, %a2 => %r = and i8 %a1, -11
Name: test 2 %a1 = add i8 %x, -108 %a2 = and i8 %x, 3 %r = sub i8 %a1, %a2 => %r = and i8 %a1, -4
show more ...
|
#
c009d11b |
| 03-Nov-2020 |
Roman Lebedev <lebedev.ri@gmail.com> |
[InstCombine] Perform C-(X+C2) --> (C-C2)-X transform before using Negator
In particular, it makes it fire for C=0, because negator doesn't want to perform that fold since in general it's not bene
[InstCombine] Perform C-(X+C2) --> (C-C2)-X transform before using Negator
In particular, it makes it fire for C=0, because negator doesn't want to perform that fold since in general it's not beneficial.
show more ...
|
#
3f3356bd |
| 10-Oct-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] allow vector splats for add+xor --> shifts
|
#
f81200ae |
| 10-Oct-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] add one-use check to add+xor transform
As shown in the affected test, we could increase instruction count without this limitation. There's another test with extra use that shows we sti
[InstCombine] add one-use check to add+xor transform
As shown in the affected test, we could increase instruction count without this limitation. There's another test with extra use that shows we still convert directly to a real "sext" if possible.
show more ...
|
#
080e6bc2 |
| 09-Oct-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] allow vector splats for add+and with high-mask
There might be a better way to specify the pre-conditions, but this is hopefully clearer than the way it was written: https://rise4fun.co
[InstCombine] allow vector splats for add+and with high-mask
There might be a better way to specify the pre-conditions, but this is hopefully clearer than the way it was written: https://rise4fun.com/Alive/Jhk3
Pre: C2 < 0 && isShiftedMask(C2) && (C1 == C1 & C2) %a = and %x, C2 %r = add %a, C1 => %a2 = add %x, C1 %r = and %a2, C2
show more ...
|
#
f688ae7a |
| 08-Oct-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] allow vector splats for add+xor with low-mask
This can be allowed with undef elements too, but that can be another step: https://alive2.llvm.org/ce/z/hnC4Z-
|
#
5ac89add |
| 08-Oct-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] remove unnecessary one-use check from add-xor transform
Pre-conditions seem to be optimal, but we don't need a use check because we are only replacing an add with a sub.
https://rise4
[InstCombine] remove unnecessary one-use check from add-xor transform
Pre-conditions seem to be optimal, but we don't need a use check because we are only replacing an add with a sub.
https://rise4fun.com/Alive/hzN
Pre: (~C1 | C2 == -1) && isPowerOf2(C2+1) %m = and i8 %x, C1 %f = xor i8 %m, C2 %r = add i8 %f, C3 => %r = sub i8 C2 + C3, %m
show more ...
|
#
b57451b0 |
| 08-Oct-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] allow vector splats for add+xor with signmask
|
Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6 |
|
#
322d0afd |
| 03-Oct-2020 |
Amara Emerson <amara@apple.com> |
[llvm][mlir] Promote the experimental reduction intrinsics to be first class intrinsics.
This change renames the intrinsics to not have "experimental" in the name.
The autoupgrader will handle lega
[llvm][mlir] Promote the experimental reduction intrinsics to be first class intrinsics.
This change renames the intrinsics to not have "experimental" in the name.
The autoupgrader will handle legacy intrinsics.
Relevant ML thread: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140729.html
Differential Revision: https://reviews.llvm.org/D88787
show more ...
|
Revision tags: llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4 |
|
#
2c4c6596 |
| 23-Sep-2020 |
Martin Storsjö <martin@martin.st> |
[InstCombine] Add parentheses in assert to silence GCC warning. NFC.
|