| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This transforms
%a = shl nuw %x, c1
%b = icmp {ugt|ule} %a, c0
into
%b = icmp {ugt|ule} %x, (c0 >> c1)
z3:
(declare-const x (_ BitVec 64))
(declare-const c0 (_ BitVec 64))
(declare-const c1 (_ BitVec 64))
(push)
(assert (= x (bvlshr (bvshl x c1) c1))) ; nuw
(assert (not (= (bvugt (bvshl x c1) c0)
(bvugt x
(bvlshr c0 c1)))))
(check-sat)
(get-model)
(pop)
(push)
(assert (= x (bvlshr (bvshl x c1) c1))) ; nuw
(assert (not (= (bvule (bvshl x c1) c0)
(bvule x
(bvlshr c0 c1)))))
(check-sat)
(get-model)
(pop)
Patch by bryant!
Differential Revision: https://reviews.llvm.org/D25913
llvm-svn: 285729
|
|
|
|
|
|
|
|
|
|
| |
Fixes the FIXMEs in D25952 and rL285075.
Patch by bryant!
Differential Revision: https://reviews.llvm.org/D25955
llvm-svn: 285108
|
|
|
|
|
|
| |
trunc transform
llvm-svn: 285075
|
|
|
|
|
|
|
| |
ICmpInst::makeConstantRange does exactly the same thing as
ConstantRange::makeExactICmpRegion.
llvm-svn: 283059
|
|
|
|
| |
llvm-svn: 281743
|
|
|
|
|
|
| |
folds; NFCI
llvm-svn: 281672
|
|
|
|
|
|
|
|
|
|
|
|
| |
These 2 helper functions were already using APInt internally, so just
change the API and caller to allow folds for splats. The scalar
regression tests look quite thorough, so I just added a couple of
tests to prove that vectors are handled too.
These folds should be grouped with the other cmp+shift folds though.
That can be an NFC follow-up.
llvm-svn: 281663
|
|
|
|
|
|
|
|
| |
canRewriteGEPAsOffset expects to process instructions, not constants.
This fixes PR30342.
llvm-svn: 281650
|
|
|
|
| |
llvm-svn: 281644
|
|
|
|
| |
llvm-svn: 281637
|
|
|
|
|
|
| |
Also, clean up the code and comments for the existing folds in foldICmpSubConstant().
llvm-svn: 281631
|
|
|
|
|
|
|
|
|
|
|
| |
This pattern is matched in foldICmpBinOpEqualityWithConstant() and already works
with vectors too. I changed some comments over there to point out the current
location. The tests for this transform are currently in 'sub.ll'.
Note that the remaining folds in this block all require a sub too, so they should
get grouped with the other icmp(sub) patterns.
llvm-svn: 281627
|
|
|
|
| |
llvm-svn: 281624
|
|
|
|
|
|
|
|
| |
1. Early exit to reduce indent
2. Rename variables
3. Add local 'Pred' variable
llvm-svn: 281615
|
|
|
|
|
|
|
| |
This is a big glob of transforms that probably should work for vectors,
but currently they are disallowed because of ConstantInt guards.
llvm-svn: 281614
|
|
|
|
|
|
| |
constant vectors
llvm-svn: 281613
|
|
|
|
|
|
| |
The pattern matching and transforms are identical; the cmp predicate just changes.
llvm-svn: 281561
|
|
|
|
|
|
| |
isSignBitCheck could be changed to take a pointer param to avoid the 'UnusedBit' ugliness.
llvm-svn: 281231
|
|
|
|
| |
llvm-svn: 281220
|
|
|
|
| |
llvm-svn: 281217
|
|
|
|
| |
llvm-svn: 281214
|
|
|
|
|
|
|
|
|
| |
foldICmpIntrinsicWithConstant ; NFC
1. Rename variables to be consistent with related/preceding code (may want to reorganize).
2. Fix comments/formatting.
llvm-svn: 281140
|
|
|
|
|
|
|
|
|
|
| |
Everything under foldICmpInstWithConstant() should now be working for
splat vectors via m_APInt matchers. Ie, I've removed all of the FIXMEs
that I added while cleaning that section up. Note that not all of the
associated FIXMEs in the regression tests are gone though, because some
of the tests require earlier folds that are still scalar-only.
llvm-svn: 281139
|
|
|
|
|
|
| |
vectors
llvm-svn: 281107
|
|
|
|
|
|
|
|
|
|
|
| |
I introduced this potential bug by missing this diff in:
https://reviews.llvm.org/rL280873
...however, I'm not sure how to reach this code path with a regression test.
We may be able to remove this code and assume that the transform to a constant
is always handled by InstSimplify?
llvm-svn: 280964
|
|
|
|
|
|
| |
splat constant vectors
llvm-svn: 280873
|
|
|
|
|
|
|
|
| |
This is a revert of r280676 which was a revert of r280637;
ie, this is r280637 again. It was speculatively reverted to
help debug buildbot failures.
llvm-svn: 280861
|
|
|
|
|
|
|
|
|
|
| |
This is effectively a revert of:
https://reviews.llvm.org/rL280115
And this should fix
https://llvm.org/bugs/show_bug.cgi?id=30281:
llvm-svn: 280677
|
|
|
|
|
|
| |
http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/14952/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3Aicmp.ll
llvm-svn: 280676
|
|
|
|
|
|
|
|
| |
The code to calculate 'UsesRemoved' could be simplified.
As-is, that code is a victim of PR30273:
https://llvm.org/bugs/show_bug.cgi?id=30273
llvm-svn: 280637
|
|
|
|
|
|
|
|
|
|
|
| |
The transform in question:
icmp (and (trunc W), C2), C1 -> icmp (and W, C2'), C1'
...is still not enabled for vectors, thus no functional change intended.
It's not clear to me if this is a good transform for vectors or even
scalars in general. Changing that behavior may be a follow-on patch.
llvm-svn: 280627
|
|
|
|
|
|
|
|
|
|
|
|
| |
While removing a scalar shackle from an icmp fold, I noticed that I couldn't find any tests to trigger
this code path.
The 'and' shrinking transform should be handled by InstCombiner::foldCastedBitwiseLogic()
or eliminated with InstSimplify. The icmp narrowing is part of InstCombiner::foldICmpWithCastAndCast().
Differential Revision: https://reviews.llvm.org/D24031
llvm-svn: 280370
|
|
|
|
|
|
|
| |
The enhancement to foldICmpDivConstant ( http://llvm.org/viewvc/llvm-project?view=revision&revision=280299 )
allows us to remove the ConstantInt check; no other changes needed.
llvm-svn: 280300
|
|
|
|
|
|
| |
Converting all of the overflow ops to APInt looked risky, so I've left that as a TODO.
llvm-svn: 280299
|
|
|
|
|
|
|
|
| |
This is prep work before changing the callers to also use APInt which will
allow folds for splat vectors. Currently, the callers have ConstantInt
guards in place, so no functional change intended with this commit.
llvm-svn: 280282
|
|
|
|
|
|
|
| |
These folds already have tests for scalar and vector types, except
for the vector div-by-0 case, so I'm adding tests for that.
llvm-svn: 280115
|
|
|
|
|
|
|
|
| |
1. Fix comments to match variable names
2. Remove redundant CmpRHS variable
3. Add FIXME to replace some checks with asserts
llvm-svn: 280112
|
|
|
|
|
|
| |
constant vectors
llvm-svn: 279937
|
|
|
|
|
|
|
|
| |
Like other recent changes near here, the goal is to allow vector types for
all of these folds. Splitting things up makes it easier to incrementally
enhance the code and easier to read.
llvm-svn: 279851
|
|
|
|
|
|
|
|
| |
1. Early exit to reduce indent
2. Fix comments and variable names to match
3. Reformat comments / clang-format code
llvm-svn: 279837
|
|
|
|
| |
llvm-svn: 279834
|
|
|
|
| |
llvm-svn: 279831
|
|
|
|
|
|
|
|
|
|
|
| |
Removing the redundant 'CmpRHSV' local variable exposes a bug in the caller
foldICmpShrConstant() - it was sending in the div constant instead of the
cmp constant. But I have not been able to expose this in a regression test
yet - the affected folds all appear to be handled before we ever reach this
code. I'll keep trying to find a case as I make changes to allow vector folds
in both functions.
llvm-svn: 279828
|
|
|
|
|
|
|
|
|
| |
foldICmpDivConstant(); NFCI
There was no logic in foldICmpDivConstant, so no need for a separate function.
The code is directly copy/pasted, so further cleanups to follow.
llvm-svn: 279685
|
|
|
|
|
|
| |
constant vectors
llvm-svn: 279677
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r279568; NFC
I deleted a fold from InstCombine at:
https://reviews.llvm.org/rL279568
because it (like any InstCombine to a constant?) should always happen in InstSimplify,
however, it's not obvious what the assumptions are in the remaining code.
Add a comment and assert to make it clearer.
Differential Revision: https://reviews.llvm.org/D23819
llvm-svn: 279626
|
|
|
|
| |
llvm-svn: 279578
|
|
|
|
|
|
|
| |
There will only be 3 lines of code in foldICmpShrConst() when the cleanup is done,
so it doesn't make much sense to have a separate function for a single fold.
llvm-svn: 279575
|
|
|
|
|
|
|
|
| |
AFAICT, these already worked in all cases for scalar types, and I enhanced
the code to work for vector types in:
https://reviews.llvm.org/rL279543
llvm-svn: 279568
|
|
|
|
|
|
|
|
| |
helpers; NFCI
This saves some casting in the helper functions and eases some further refactoring.
llvm-svn: 279478
|