summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/icmp.ll
Commit message (Collapse)AuthorAgeFilesLines
...
* [InstCombine] make icmp-mul fold more efficientSanjay Patel2017-05-251-1/+1
| | | | | | | | | | | There's probably a lot more like this (see also comments in D33338 about responsibility), but I suspect we don't usually get a visible manifestation. Given the recent interest in improving InstCombine efficiency, another potential micro-opt that could be repeated several times in this function: morph the existing icmp pred/operands instead of creating a new instruction. llvm-svn: 303860
* [InstCombine] use m_APInt to allow icmp-mul-mul vector foldSanjay Patel2017-05-241-6/+4
| | | | | | | | | The swapped operands in the first test is a manifestation of an inefficiency for vectors that doesn't exist for scalars because the IRBuilder checks for an all-ones mask for scalars, but not vectors. llvm-svn: 303818
* [InstCombine] add tests for icmp eq (mul X, C), (mul Y, C); NFCSanjay Patel2017-05-241-0/+43
| | | | llvm-svn: 303816
* [InstCombine] move tests and use FileCheck; NFCSanjay Patel2017-05-241-0/+23
| | | | llvm-svn: 303808
* [InstCombine] restrict icmp fold with 2 sdiv exact operands (PR32949)Sanjay Patel2017-05-151-2/+4
| | | | | | | | | | | | | | | | This is the InstCombine counterpart to D32954. I added some comments about the code duplication in: rL302436 Alive-based verification: http://rise4fun.com/Alive/dPw This is a 2nd fix for the problem reported in: https://bugs.llvm.org/show_bug.cgi?id=32949 Differential Revision: https://reviews.llvm.org/D32970 llvm-svn: 303105
* [InstCombine] add another test for PR32949; NFCSanjay Patel2017-05-081-0/+13
| | | | | | | A patch for the InstSimplify variant of this bug is up for review here: https://reviews.llvm.org/D32954 llvm-svn: 302434
* [InstCombine] add/move tests for or-of-icmps; NFCSanjay Patel2017-04-131-13/+0
| | | | | | | If we had these tests, the bug caused by https://reviews.llvm.org/rL299851 would have been caught sooner. There's also an assert in the code that should have caught that bug, but the assert line itself has a bug. llvm-svn: 300201
* [InstCombine] add fold for icmp with or mask of low bits (PR32542)Sanjay Patel2017-04-051-8/+5
| | | | | | | | | | | | | | | | | | | | We already have these 'and' folds: // X & -C == -C -> X > u ~C // X & -C != -C -> X <= u ~C // iff C is a power of 2 ...but we were missing the 'or' siblings. http://rise4fun.com/Alive/n6 This should improve: https://bugs.llvm.org/show_bug.cgi?id=32524 ...but there are 2 or more other pieces to fix still. Differential Revision: https://reviews.llvm.org/D31712 llvm-svn: 299570
* [InstCombine] add tests for missing icmp fold (PR32524)Sanjay Patel2017-04-051-0/+52
| | | | llvm-svn: 299557
* [InstCombine] add test for missed vector icmp fold; NFCSanjay Patel2017-02-081-10/+0
| | | | | | | Also, move the related existing scalar test to a renamed file where I'm planning to add more icmp-add tests. llvm-svn: 294487
* [InstCombine] fix operand-complexity-based canonicalization (PR28296)Sanjay Patel2017-02-031-8/+8
| | | | | | | | | | | | | | | | | | | The code comments didn't match the code logic, and we didn't actually distinguish the fake unary (not/neg/fneg) operators from arguments. Adding another level to the weighting scheme provides more structure and can help simplify the pattern matching in InstCombine and other places. I fixed regressions that would have shown up from this change in: rL290067 rL290127 But that doesn't mean there are no pattern-matching logic holes left; some combines may just be missing regression tests. Should fix: https://llvm.org/bugs/show_bug.cgi?id=28296 Differential Revision: https://reviews.llvm.org/D27933 llvm-svn: 294049
* [InstCombine] use m_APInt to allow ashr folds for vectors with splat constantsSanjay Patel2017-01-151-4/+3
| | | | llvm-svn: 292064
* [InstCombine] optimize unsigned icmp of incrementSanjay Patel2017-01-131-0/+144
| | | | | | | | | | | | | | | | | | | | | | | Allows LLVM to optimize sequences like the following: %add = add nuw i32 %x, 1 %cmp = icmp ugt i32 %add, %y Into: %cmp = icmp uge i32 %x, %y Previously, only signed comparisons were being handled. Decrements could also be handled, but 'sub nuw %x, 1' is currently canonicalized to 'add %x, -1' in InstCombineAddSub, losing the nuw flag. Removing that canonicalization seems like it might have far-reaching ramifications so I kept this simple for now. Patch by Matti Niemenmaa! Differential Revision: https://reviews.llvm.org/D24700 llvm-svn: 291975
* [InstCombine] move and add tests for icmp + shl nsw; NFCSanjay Patel2017-01-061-63/+0
| | | | | | | | As discussed here: http://lists.llvm.org/pipermail/llvm-dev/2017-January/108749.html ...we should be able to better optimize this pattern. llvm-svn: 291262
* [InstCombine] Ensure that truncated int types are legal.Sanjay Patel2016-10-251-3/+3
| | | | | | | | | | Fixes the FIXMEs in D25952 and rL285075. Patch by bryant! Differential Revision: https://reviews.llvm.org/D25955 llvm-svn: 285108
* [InstCombine] add test and code comment to show potentially misguided icmp ↵Sanjay Patel2016-10-251-0/+13
| | | | | | trunc transform llvm-svn: 285075
* [InstCombine] allow icmp (shr/shl) folds for vectorsSanjay Patel2016-09-151-0/+10
| | | | | | | | | | | | 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
* [InstCombine] allow icmp (sub nsw) folds for vectorsSanjay Patel2016-09-151-8/+4
| | | | | | Also, clean up the code and comments for the existing folds in foldICmpSubConstant(). llvm-svn: 281631
* [InstCombine] add vector tests for icmp (sub nsw)Sanjay Patel2016-09-151-0/+44
| | | | llvm-svn: 281630
* [InstCombine] use m_APInt to allow icmp folds using known bits for splat ↵Sanjay Patel2016-09-151-28/+7
| | | | | | constant vectors llvm-svn: 281613
* [InstCombine] add vector tests for foldICmpUsingKnownBits()Sanjay Patel2016-09-141-3/+97
| | | | llvm-svn: 281559
* Reapply "InstCombine: Reduce trunc (shl x, K) width."Matt Arsenault2016-09-131-3/+3
| | | | | | | This reapplies r272987 with a fix for infinitely looping when the truncated value is another shift of a constant. llvm-svn: 281379
* [InstCombine] use m_APInt to allow icmp ult X, C folds for splat constant ↵Sanjay Patel2016-09-091-1/+0
| | | | | | vectors llvm-svn: 281107
* [InstCombine] use m_APInt to allow icmp (and (sh X, Y), C2), C1 folds for ↵Sanjay Patel2016-09-071-4/+2
| | | | | | splat constant vectors llvm-svn: 280873
* [InstCombine] allow icmp (and X, C2), C1 folds for splat constant vectorsSanjay Patel2016-09-071-12/+22
| | | | | | | | 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
* [InstCombine] revert r280637 because it causes test failures on an ARM botSanjay Patel2016-09-051-22/+12
| | | | | | 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
* [InstCombine] allow icmp (and X, C2), C1 folds for splat constant vectorsSanjay Patel2016-09-041-12/+22
| | | | | | | | 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
* [InstCombine] allow icmp (div X, Y), C folds for splat constant vectorsSanjay Patel2016-08-311-3/+1
| | | | | | Converting all of the overflow ops to APInt looked risky, so I've left that as a TODO. llvm-svn: 280299
* [InstCombine] use m_APInt to allow icmp (and X, Y), C folds for splat ↵Sanjay Patel2016-08-281-6/+2
| | | | | | constant vectors llvm-svn: 279937
* [InstCombine] use m_APInt to allow icmp eq/ne (shr X, C2), C folds for splat ↵Sanjay Patel2016-08-241-0/+20
| | | | | | constant vectors llvm-svn: 279677
* [InstCombine] use m_APInt to allow icmp (shr exact X, Y), 0 folds for splat ↵Sanjay Patel2016-08-221-4/+2
| | | | | | constant vectors llvm-svn: 279472
* [InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat ↵Sanjay Patel2016-08-211-3/+2
| | | | | | | | | | | constant vectors, part 4 This concludes the fixes for icmp+shl in this series: https://reviews.llvm.org/rL279339 https://reviews.llvm.org/rL279398 https://reviews.llvm.org/rL279399 llvm-svn: 279401
* [InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat ↵Sanjay Patel2016-08-211-3/+1
| | | | | | | | constant vectors, part 2 This is a partial enablement (move the ConstantInt guard down). llvm-svn: 279398
* [InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat ↵Sanjay Patel2016-08-191-12/+16
| | | | | | | | | constant vectors, part 1 This is a partial enablement (move the ConstantInt guard down) because there are many different folds here and one of the later ones will require reworking 'isSignBitCheck'. llvm-svn: 279339
* Fix regression in InstCombine introduced by r278944Reid Kleckner2016-08-191-0/+13
| | | | | | | | | | | The intended transform is: // Simplify icmp eq (or (ptrtoint P), (ptrtoint Q)), 0 // -> and (icmp eq P, null), (icmp eq Q, null). P and Q are both pointer types, but may have different types. We need two calls to getNullValue() to make the icmps. llvm-svn: 279271
* [InstCombine] use m_APInt to allow icmp (shl 1, Y), C folds for splat ↵Sanjay Patel2016-08-191-24/+8
| | | | | | constant vectors llvm-svn: 279266
* [InstCombine] use m_APInt to allow icmp X, C folds for splat constant vectorsSanjay Patel2016-08-191-2/+6
| | | | | | | | | Of course, we really need to refactor and fix all of the cmp predicates, but this one is interesting because without it, we later perform an information-losing transform of icmp (shl 1, Y), C, and we can't recover the better fold. llvm-svn: 279263
* [InstCombine] add tests for missing vector icmp foldsSanjay Patel2016-08-191-0/+17
| | | | llvm-svn: 279259
* [InstCombine] add missing tests for basic icmp foldsSanjay Patel2016-08-191-0/+19
| | | | | | | These are implicitly included as part of larger test cases, but they don't exist stand-alone (and don't happen for vectors...). llvm-svn: 279257
* [InstCombine] use m_APInt to allow icmp (mul X, Y), C folds for splat ↵Sanjay Patel2016-08-181-3/+1
| | | | | | | | | | | | constant vectors This is a sibling of: https://reviews.llvm.org/rL278859 https://reviews.llvm.org/rL278935 https://reviews.llvm.org/rL278945 https://reviews.llvm.org/rL279066 llvm-svn: 279077
* [InstCombine] use m_APInt to allow icmp (xor X, Y), C folds for splat ↵Sanjay Patel2016-08-181-6/+2
| | | | | | | | | | | constant vectors This is a sibling of: https://reviews.llvm.org/rL278859 https://reviews.llvm.org/rL278935 https://reviews.llvm.org/rL278945 llvm-svn: 279066
* [InstCombine] add test for missing vector icmp foldSanjay Patel2016-08-171-12/+36
| | | | | | | | Also, add a scalar test to demonstrate one of the intermediate folds that is necessary to accomplish the existing, multi-step test. And simplify the vector tests to only check the final piece of that multi-step transform. llvm-svn: 278995
* [InstCombine] use m_APInt to allow icmp (add X, Y), C folds for splat ↵Sanjay Patel2016-08-171-6/+4
| | | | | | | | | constant vectors This is a sibling of: https://reviews.llvm.org/rL278859 llvm-svn: 278935
* [InstCombine] use m_APInt to allow icmp (sub X, Y), C folds for splat ↵Sanjay Patel2016-08-161-6/+4
| | | | | | constant vectors llvm-svn: 278859
* [InstCombine] add tests for missing vector icmp foldsSanjay Patel2016-08-161-0/+24
| | | | llvm-svn: 278768
* [InstCombine] add tests for missing vector icmp foldsSanjay Patel2016-08-161-0/+72
| | | | llvm-svn: 278765
* [InstCombine] add tests for missing vector icmp foldsSanjay Patel2016-08-151-0/+72
| | | | llvm-svn: 278757
* [InstCombine] add tests for missing vector icmp foldsSanjay Patel2016-08-151-8/+21
| | | | llvm-svn: 278751
* [InstCombine] add tests for missing vector icmp foldsSanjay Patel2016-08-151-0/+24
| | | | llvm-svn: 278737
* [InstCombine] add test for missing vector icmp foldSanjay Patel2016-08-151-0/+12
| | | | llvm-svn: 278727
OpenPOWER on IntegriCloud