Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
For i1 operations, we may end up returning an empty range instead
of a full one. Make sure to use the getNonEmpty constructor.
Fixes https://github.com/llvm/llvm-project/issues/62760.
|
|
We now of an implementation of `KnownBits::sdiv` so we can implement
this case.
Differential Revision: https://reviews.llvm.org/D150096
|
|
This information was previously missing but we can use it for
determining the low-bits.
Differential Revision: https://reviews.llvm.org/D150095
|
|
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
|
|
This is in preparation for replacing the implementation
with a wrapper around computeKnownFPClass.
|
|
In D148674, the negative condition was weakened to only
checking isKnownNever(fcNegative), instead of cannotBeOrderedLessThanZero().
This avoids a regression when CannotBeOrderedLessThanZero is
replaced with computeKnownFPClass.
|
|
Copied from CannotBeNegativeZero and extended to cover fsub.
|
|
Could be slightly smarter in cases that are probably uninteresting.
|
|
Define intersectWith and unionWith as two complementary ways of
combining KnownBits. The names are chosen for consistency with
ConstantRange.
Deprecate commonBits as a synonym for intersectWith.
Differential Revision: https://reviews.llvm.org/D150443
|
|
|
|
Update code that assumes llvm.canonicalize only handles scalars,
by adding a call to getScalarType().
This is fine, as the intrinsic is trivially vectorizable.
Introduced in D147870, and uncovered by D148065.
Differential Revision: https://reviews.llvm.org/D150556
|
|
This reverts commit 706e8110573c83f140a63b40803d6370c86c1414.
|
|
`div`/`rem` are safe to speculate"
Seems to be causing a bug in CorrelatedValuePropegation. Reverting
while the issue is investigated.
This reverts commit 6c667abf3294d61e4fbe1238e1755c79f7547f1b.
|
|
This broke two lit tests:
LLVM :: Transforms/LoopSimplify/merge-exits.ll
LLVM :: Transforms/PhaseOrdering/X86/vector-reductions.ll
see comment on the code review.
> Differential Revision: https://reviews.llvm.org/D149934
This reverts commit 2ba4cfd56769ab50c9c6f432f93265d7793bd1f2.
|
|
Differential Revision: https://reviews.llvm.org/D149934
|
|
This patch fixes:
llvm/lib/Analysis/ValueTracking.cpp:895:12: error: unused variable
'BitWidth' [-Werror,-Wunused-variable]
|
|
Separate the part which is specific for assume intrinsic from the part which only requires an icmp,
so that the latter could be reused for other purposes (e.g. in dominating conditions).
Differential Revision: https://reviews.llvm.org/D149940
Reviewed By: nikic
|
|
There is a lot of copy-paste-ish checks while this can be done once.
Differential Revision: https://reviews.llvm.org/D149939
Reviewed By: nikic
|
|
Partially `fix` https://github.com/llvm/llvm-project/issues/62441.
Extend isImpliedCondOperands() to handle ugt/uge and sgt/sge predicates.
alive2 proof: https://alive2.llvm.org/ce/z/jLFDAv and
https://alive2.llvm.org/ce/z/Z8idUd
Differential Revision: https://reviews.llvm.org/D149510
|
|
If we know one operand is positive for maxnum, or one is negative
for minnum, the result will have the same sign.
|
|
|
|
|
|
`div`/`rem` are safe to speculate" (2nd Try)
Add `poison` checks that where missing.
Reviewed By: nikic
|
|
`div`/`rem` are safe to speculate"
Appears to be causing out-of-tree test failures. Reverting while the
issue is investigated.
This reverts commit fbc7fcf5ae26fad7db3e7c861fc6447e02b39cf0.
|
|
safe to speculate
This just replaces the exact constant requirements with known-bits
which can prove better results.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149423
|
|
Two changes:
1) Make some cases that conditionally returned unconditional.
2) In cases of `Op0 != 0 || Op1 != 0` its better check `Op1` first
as its more likely to be a constant due to canonicalization (so
faster to get knownbits of).
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149419
|
|
If either `X` or `Y` is odd and the other is non-zero, the result is
non-zero.
Alive2 Link:
https://alive2.llvm.org/ce/z/9V7-es
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149418
|
|
For `smin` if either `X` or `Y` is negative, the result is non-zero.
For `smax` if either `X` or `Y` is strictly positive, the result is
non-zero.
For both if `X != 0` and `Y != 0` the result is non-zero.
Alive2 Link:
https://alive2.llvm.org/ce/z/7yvbgN
https://alive2.llvm.org/ce/z/zizbvq
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149417
|
|
`(umin X, Y) != 0` -> `X != 0 && Y != 0`
Alive2 Link:
https://alive2.llvm.org/ce/z/AQh67i
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149416
|
|
`(umax X, Y) != 0` -> `X != 0 || Y != 0`
Alive2 Link:
https://alive2.llvm.org/ce/z/_Z9AUT
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149415
|
|
The logic here is the same for `add` so reuse the existing helper
`isNonZeroAdd`
Alive2 Link:
https://alive2.llvm.org/ce/z/mhKvC5
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149414
|
|
The logic here is the same for normal `(sub X, Y)`, so just reused
`isNonZeroSub`.
Alive2 Link:
https://alive2.llvm.org/ce/z/9kSkMv
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149412
|
|
`(sshl/ushl X, Y) != 0` -> `X != 0`
Alive2 Links
https://alive2.llvm.org/ce/z/4WLM2p
https://alive2.llvm.org/ce/z/BHFng4
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149411
|
|
for `cttz` if `X[0]` is non-zero, then the expression is non-zero.
for `ctlz` if `X[SignBit]` is non-zero, then the expression in
non-zero.
Alive2 Links:
cttz (false): https://alive2.llvm.org/ce/z/ySQzbg
cttz (true): https://alive2.llvm.org/ce/z/auiTCJ
ctlz (false): https://alive2.llvm.org/ce/z/yk3sTJ
ctlz (true): https://alive2.llvm.org/ce/z/-JuDty
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149410
|
|
We where missing these cases so something like:
`(bitcast to i32 (or v216 x, <2, 1>))`
would not be found to be non-zero.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149409
|
|
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149407
|
|
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149406
|
|
If both the true and false operands of a `select` are poison, then the `select`
is poison.
Differential Revision: https://reviews.llvm.org/D149427
|
|
Having `A == B` is quite common for rotate patterns.
Alive2 Links:
- https://alive2.llvm.org/ce/z/mPXi9c
- https://alive2.llvm.org/ce/z/UfDHoI
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149372
|
|
Alive2 Link:
https://alive2.llvm.org/ce/z/2DKh46
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149203
|
|
Following the change in shufflevector semantics,
poison will be used to represent undefined elements in shufflevector masks.
Differential Revision: https://reviews.llvm.org/D149256
|
|
Alive2 Link:
https://alive2.llvm.org/ce/z/TKpqxc
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149204
|
|
Alive2 Link:
https://alive2.llvm.org/ce/z/TAFcjF
Differential Revision: https://reviews.llvm.org/D149202
|
|
Add support the cases like
m(m(X,Y),m'(X,Y)) => m(X,Y)
where m is one of maxnum, minnum, maximum, minimum and
m' is m or inverse of m.
alive2 correctness check:
maxnum(maxnum,maxnum) https://alive2.llvm.org/ce/z/kSyAzo
maxnum(maxnum,minnum) https://alive2.llvm.org/ce/z/Vra8j2
minnum(minnum,minnum) https://alive2.llvm.org/ce/z/B6h-hW
minnum(minnum,maxnum) https://alive2.llvm.org/ce/z/rG2u_b
maximum(maximum,maximum) https://alive2.llvm.org/ce/z/N2nevY
maximum(maximum,minimum) https://alive2.llvm.org/ce/z/23RFcP
minimum(minimum,minimum) https://alive2.llvm.org/ce/z/spHZ-U
minimum(minimum,maximum) https://alive2.llvm.org/ce/z/Aa-VE8
Reviewed By: dantrushin, RKSimon
Differential Revision: https://reviews.llvm.org/D147137
|
|
As LangRef says, "dereferenceable<n> implies noundef".
`isGuaranteedNotToBeUndefOrPoison` should return true if the parameter
has dereferenceable attribute.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149035
|
|
I barely understand what this does, but try to
handle the last case required to delete cannotBeOrderedLessThanZeroImpl.
Also improve by following fdiv handling for nans and identical operand case.
|
|
Copy what cannotBeOrderedLessThanZeroImpl checks for fdiv.
|
|
|