|
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3 |
|
| #
3bf2295e |
| 16-Oct-2024 |
Yingwei Zheng <dtcxzyw2333@gmail.com> |
[InstCombine] Drop `samesign` flag in `foldAndOrOfICmpsWithConstEq` (#112489)
In
https://github.com/llvm/llvm-project/commit/5dbfca30c1a672cd0c5089df2b4fdd171436643a
we assume that RHS is poison i
[InstCombine] Drop `samesign` flag in `foldAndOrOfICmpsWithConstEq` (#112489)
In
https://github.com/llvm/llvm-project/commit/5dbfca30c1a672cd0c5089df2b4fdd171436643a
we assume that RHS is poison implies LHS is also poison. It doesn't hold
after introducing samesign flag.
This patch drops the `samesign` flag on RHS if the original expression
is a logical and/or.
Closes #112467.
show more ...
|
|
Revision tags: llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1 |
|
| #
acdc419c |
| 04-Feb-2022 |
Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> |
[test] Use -passes=instcombine instead of -instcombine in lots of tests. NFC
Another step moving away from the deprecated syntax of specifying pass pipeline in opt.
Differential Revision: https://r
[test] Use -passes=instcombine instead of -instcombine in lots of tests. NFC
Another step moving away from the deprecated syntax of specifying pass pipeline in opt.
Differential Revision: https://reviews.llvm.org/D119081
show more ...
|
|
Revision tags: llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1 |
|
| #
8a156d1c |
| 02-May-2021 |
Juneyoung Lee <aqjune@gmail.com> |
[InstCombine] Fully disable select to and/or i1 folding
This is a patch that disables the poison-unsafe select -> and/or i1 folding.
It has been blocking D72396 and also has been the source of a fe
[InstCombine] Fully disable select to and/or i1 folding
This is a patch that disables the poison-unsafe select -> and/or i1 folding.
It has been blocking D72396 and also has been the source of a few miscompilations described in llvm.org/pr49688 . D99674 conditionally blocked this folding and successfully fixed the latter one. The former one was still blocked, and this patch addresses it.
Note that a few test functions that has `_logical` suffix are now deoptimized. These are created by @nikic to check the impact of disabling this optimization by copying existing original functions and replacing and/or with select.
I can see that most of these are poison-unsafe; they can be revived by introducing freeze instruction. I left comments at fcmp + select optimizations (or-fcmp.ll, and-fcmp.ll) because I think they are good targets for freeze fix.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D101191
show more ...
|
|
Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, 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 |
|
| #
fb063c93 |
| 12-Jan-2021 |
Nikita Popov <nikita.ppv@gmail.com> |
[InstCombine] Duplicate tests for logical and/or (NFC)
This replicates existing and/or tests to also test variants using select. This should help us get a more accurate view on which optimizations w
[InstCombine] Duplicate tests for logical and/or (NFC)
This replicates existing and/or tests to also test variants using select. This should help us get a more accurate view on which optimizations we're missing if we disable the select -> and/or fold.
show more ...
|
|
Revision tags: llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1 |
|
| #
62da6ece |
| 23-Apr-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] substitute equivalent constant to reduce logic-of-icmps
(X == C) && (Y Pred1 X) --> (X == C) && (Y Pred1 C) (X != C) || (Y Pred1 X) --> (X != C) || (Y Pred1 C)
This cooperates/overlap
[InstCombine] substitute equivalent constant to reduce logic-of-icmps
(X == C) && (Y Pred1 X) --> (X == C) && (Y Pred1 C) (X != C) || (Y Pred1 X) --> (X != C) || (Y Pred1 C)
This cooperates/overlaps with D78430, but it is a more general transform that gets us most of the expected simplifications and several other improvements. http://volta.cs.utah.edu:8080/z/5gxjjc
PR45618: https://bugs.llvm.org/show_bug.cgi?id=45618
Differential Revision: https://reviews.llvm.org/D78582
show more ...
|
| #
e86eff0e |
| 23-Apr-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstSimplify] fold and/or of compares with equality to min/max constant
I found 12 (6 if we compress the DeMorganized forms) patterns for logic-of-compares with a min/max constant while looking at
[InstSimplify] fold and/or of compares with equality to min/max constant
I found 12 (6 if we compress the DeMorganized forms) patterns for logic-of-compares with a min/max constant while looking at PR45510: https://bugs.llvm.org/show_bug.cgi?id=45510
The variations on those forms multiply the test cases by 8 (unsigned/signed, swapped compare operands, commuted logic operands). We have partial logic to deal with these for the unsigned min (zero) case, but missed everything else.
We are deferring the majority of these patterns to InstCombine to allow more general handling (see D78582).
We could use ConstantRange instead of predicate+constant matching here. I don't expect there's any noticeable compile-time impact for either form.
Here's an abuse of Alive2 to show the 12 basic signed variants of the patterns in one function: http://volta.cs.utah.edu:8080/z/5Vpiyg
declare void @use(i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1) define void @src(i8 %x, i8 %y) { %m1 = icmp eq i8 %x, 127 %c1 = icmp slt i8 %x, %y %r1 = and i1 %m1, %c1 ; (X == MAX) && (X < Y) --> false
%m2 = icmp ne i8 %x, 127 %c2 = icmp sge i8 %x, %y %r2 = or i1 %m2, %c2 ; (X != MAX) || (X >= Y) --> true
%m3 = icmp eq i8 %x, -128 %c3 = icmp sgt i8 %x, %y %r3 = and i1 %m3, %c3 ; (X == MIN) && (X > Y) --> false
%m4 = icmp ne i8 %x, -128 %c4 = icmp sle i8 %x, %y %r4 = or i1 %m4, %c4 ; (X != MIN) || (X <= Y) --> true
%m5 = icmp eq i8 %x, 127 %c5 = icmp sge i8 %x, %y %r5 = and i1 %m5, %c5 ; (X == MAX) && (X >= Y) --> X == MAX
%m6 = icmp ne i8 %x, 127 %c6 = icmp slt i8 %x, %y %r6 = or i1 %m6, %c6 ; (X != MAX) || (X < Y) --> X != MAX
%m7 = icmp eq i8 %x, -128 %c7 = icmp sle i8 %x, %y %r7 = and i1 %m7, %c7 ; (X == MIN) && (X <= Y) --> X == MIN
%m8 = icmp ne i8 %x, -128 %c8 = icmp sgt i8 %x, %y %r8 = or i1 %m8, %c8 ; (X != MIN) || (X > Y) --> X != MIN
%m9 = icmp ne i8 %x, 127 %c9 = icmp slt i8 %x, %y %r9 = and i1 %m9, %c9 ; (X != MAX) && (X < Y) --> X < Y
%m10 = icmp eq i8 %x, 127 %c10 = icmp sge i8 %x, %y %r10 = or i1 %m10, %c10 ; (X == MAX) || (X >= Y) --> X >= Y
%m11 = icmp ne i8 %x, -128 %c11 = icmp sgt i8 %x, %y %r11 = and i1 %m11, %c11 ; (X != MIN) && (X > Y) --> X > Y
%m12 = icmp eq i8 %x, -128 %c12 = icmp sle i8 %x, %y %r12 = or i1 %m12, %c12 ; (X == MIN) || (X <= Y) --> X <= Y
call void @use(i1 %r1, i1 %r2, i1 %r3, i1 %r4, i1 %r5, i1 %r6, i1 %r7, i1 %r8, i1 %r9, i1 %r10, i1 %r11, i1 %r12) ret void }
define void @tgt(i8 %x, i8 %y) { %m5 = icmp eq i8 %x, 127 %m6 = icmp ne i8 %x, 127 %m7 = icmp eq i8 %x, -128 %m8 = icmp ne i8 %x, -128 %c9 = icmp slt i8 %x, %y %c10 = icmp sge i8 %x, %y %c11 = icmp sgt i8 %x, %y %c12 = icmp sle i8 %x, %y call void @use(i1 0, i1 1, i1 0, i1 1, i1 %m5, i1 %m6, i1 %m7, i1 %m8, i1 %c9, i1 %c10, i1 %c11, i1 %c12) ret void }
Differential Revision: https://reviews.llvm.org/D78430
show more ...
|
| #
44a8c541 |
| 21-Apr-2020 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] add tests for logic-of-icmps; NFC
These are mostly replicated from D78430 (instsimplify). If we implement more general transforms for instcombine, then we probably don't need to add th
[InstCombine] add tests for logic-of-icmps; NFC
These are mostly replicated from D78430 (instsimplify). If we implement more general transforms for instcombine, then we probably don't need to add that complexity to instsimplify.
show more ...
|