summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [InstCombine] use m_APInt to allow icmp (shr exact X, Y), 0 folds for splat ↵Sanjay Patel2016-08-221-14/+13
| | | | | | constant vectors llvm-svn: 279472
* [InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat ↵Sanjay Patel2016-08-211-13/+10
| | | | | | | | | | | 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-6/+6
| | | | | | | | constant vectors, part 3 This is a partial enablement (move the ConstantInt guard down). llvm-svn: 279399
* [InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat ↵Sanjay Patel2016-08-211-6/+6
| | | | | | | | constant vectors, part 2 This is a partial enablement (move the ConstantInt guard down). llvm-svn: 279398
* [InstCombine] use APInt instead of ConstantInt in isSignBitCheck(); NFCISanjay Patel2016-08-211-8/+8
| | | | | | | | The callers still have ConstantInt guards, so there is no functional change intended from this change. But relaxing the callers will allow more folds for vector types. llvm-svn: 279396
* [InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat ↵Sanjay Patel2016-08-191-17/+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
* [InstCombine] remove an icmp fold that is already handled by InstSimplifySanjay Patel2016-08-191-10/+0
| | | | | | | | | | | | Specifically, this is done near the end of "SimplifyICmpInst" using computeKnownBits() as the broader solution. There are even vector tests (yay!) for this in test/Transforms/InstSimplify/compare.ll. I considered putting an assert here instead of just deleting, but then we could assert every possible fold in InstSimplify in InstCombine, so...less is more? llvm-svn: 279300
* [InstCombine] use local variables to reduce code in foldICmpShlConstant; NFCSanjay Patel2016-08-191-21/+15
| | | | llvm-svn: 279282
* [InstCombine] rename variables in foldICmpShlConstant(); NFCSanjay Patel2016-08-191-34/+34
| | | | llvm-svn: 279279
* Fix regression in InstCombine introduced by r278944Reid Kleckner2016-08-191-3/+4
| | | | | | | | | | | 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-4/+5
| | | | | | constant vectors llvm-svn: 279266
* [InstCombine] use m_APInt to allow icmp X, C folds for splat constant vectorsSanjay Patel2016-08-191-5/+10
| | | | | | | | | 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 helper function for folds of icmp (shl 1, Y), C; NFCISanjay Patel2016-08-181-62/+65
| | | | | | | | | | | | | Clean up the existing code by: 1. Renaming variables 2. Adding local variables 3. Making it vector-safe This is still guarded by a ConstantInt check, so no functional change is intended. But this should be ready to go: if we move the ConstantInt check down, all of these folds should do the right thing for vector types. llvm-svn: 279150
* [InstCombine] use m_APInt to allow icmp (trunc X, Y), C folds for splat ↵Sanjay Patel2016-08-181-9/+4
| | | | | | | | | | | | | | 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 https://reviews.llvm.org/rL279077 https://reviews.llvm.org/rL279101 llvm-svn: 279133
* [InstCombine] clean up foldICmpTruncConstant(); NFCISanjay Patel2016-08-181-14/+17
| | | | | | | 1. Fix variable names 2. Add local variables to reduce code llvm-svn: 279132
* [InstCombine] use m_APInt to allow icmp (udiv X, Y), C folds for splat ↵Sanjay Patel2016-08-181-18/+20
| | | | | | | | | | | | | 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 https://reviews.llvm.org/rL279077 llvm-svn: 279101
* [InstCombine] clean up foldICmpUDivConstant; NFCSanjay Patel2016-08-181-16/+12
| | | | | | | 1. Better variable names 2. Remove unnecessary check of ConstantInt llvm-svn: 279094
* [InstCombine] use m_APInt to allow icmp (mul X, Y), C folds for splat ↵Sanjay Patel2016-08-181-18/+14
| | | | | | | | | | | | 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 APInt in isSignTest instead of ConstantInt; NFCSanjay Patel2016-08-181-6/+7
| | | | | | | This will enable vector splat folding, but NFC until the callers have their ConstantInt restrictions removed. llvm-svn: 279072
* [InstCombine] use m_APInt to allow icmp (xor X, Y), C folds for splat ↵Sanjay Patel2016-08-181-13/+10
| | | | | | | | | | | 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
* Replace a few more "fall through" comments with LLVM_FALLTHROUGHJustin Bogner2016-08-171-6/+9
| | | | | | Follow up to r278902. I had missed "fall through", with a space. llvm-svn: 278970
* [InstCombine] more clean up of foldICmpXorConstant(); NFCISanjay Patel2016-08-171-27/+21
| | | | | | | Use m_APInt for the xor constant, but this is all still guarded by the initial ConstantInt check, so no vector types should make it in here. llvm-svn: 278957
* [InstCombine] clean up foldICmpXorConstant(); NFCISanjay Patel2016-08-171-55/+60
| | | | | | | | 1. Change variable names 2. Use local variables to reduce code 3. Early exit to reduce indent llvm-svn: 278955
* [InstCombine] use m_APInt to allow icmp (or X, Y), C folds for splat ↵Sanjay Patel2016-08-171-5/+0
| | | | | | | | | | constant vectors This is a sibling of: https://reviews.llvm.org/rL278859 https://reviews.llvm.org/rL278935 llvm-svn: 278945
* [InstCombine] clean up foldICmpOrConstant(); NFCISanjay Patel2016-08-171-18/+16
| | | | | | | | | 1. Change variable names 2. Use local variables to reduce code 3. Use ? instead of if/else 4. Use the APInt variable instead of 'RHS' so the removal of the FIXME code will be direct llvm-svn: 278944
* [InstCombine] use m_APInt to allow icmp (add X, Y), C folds for splat ↵Sanjay Patel2016-08-171-34/+29
| | | | | | | | | constant vectors This is a sibling of: https://reviews.llvm.org/rL278859 llvm-svn: 278935
* Replace "fallthrough" comments with LLVM_FALLTHROUGHJustin Bogner2016-08-171-2/+2
| | | | | | | This is a mechanical change of comments in switches like fallthrough, fall-through, or fall-thru to use the LLVM_FALLTHROUGH macro instead. llvm-svn: 278902
* [InstCombine] clean up foldICmpAddConstant(); NFCISanjay Patel2016-08-161-44/+41
| | | | | | | | | | | 1. Fix variable names 2. Add local variables to reduce code 3. Fix code comments 4. Add early exit to reduce indentation 5. Remove 'else' after if -> return 6. Hoist common predicate llvm-svn: 278864
* [InstCombine] use m_APInt to allow icmp (sub X, Y), C folds for splat ↵Sanjay Patel2016-08-161-15/+10
| | | | | | constant vectors llvm-svn: 278859
* [InstCombine] fix variable names to match formula comments; NFCSanjay Patel2016-08-161-17/+17
| | | | llvm-svn: 278855
* [InstCombine] add helper functions for foldICmpWithConstant; NFCISanjay Patel2016-08-161-585/+698
| | | | | | | | | | | | | Besides breaking up a 700 line function to improve readability, this sinks the 'FIXME: ConstantInt' check into each helper. So now we can independently break that restriction within any of the helper functions. As much as possible, the code was only {cut/paste/clang-format}'ed to minimize risk (no functional changes intended), so several more readability improvements are still possible. llvm-svn: 278828
* [InstCombine] use m_APInt in foldICmpWithConstant; NFCISanjay Patel2016-08-161-47/+45
| | | | | | | | | | | There's some formatting and pointer deref ugliness here that I intend to fix in subsequent patches. The overall goal is to refactor the obnoxiously long switch and incrementally remove the restriction to scalar types (allow folds for vector splats). This patch introduces the use of m_APInt which means the RHSV reference is now a pointer (and may have matched a vector splat), but the check of 'RHS' remains, so vector folds are disallowed and no functional change is intended. llvm-svn: 278816
* constify InstCombine::foldAllocaCmp. NFC.Pete Cooper2016-08-121-9/+10
| | | | | | | | This is part of an effort to constify ValueTracking.cpp. This change is to methods which need const Value* instead of Value* to go with the upcoming changes to ValueTracking. llvm-svn: 278528
* InstCombine: Clean up some trailing whitespace. NFCJustin Bogner2016-08-051-7/+7
| | | | llvm-svn: 277793
* InstCombine: Replace some never-null pointers with references. NFCJustin Bogner2016-08-051-9/+6
| | | | llvm-svn: 277792
* [InstCombine] use m_APInt to allow icmp eq (mul X, C1), C2 folds for splat ↵Sanjay Patel2016-08-041-6/+5
| | | | | | | | | | | | | | | | constant vectors This concludes the splat vector enhancements for foldICmpEqualityWithConstant(). Other commits in this series: https://reviews.llvm.org/rL277762 https://reviews.llvm.org/rL277752 https://reviews.llvm.org/rL277738 https://reviews.llvm.org/rL277731 https://reviews.llvm.org/rL277659 https://reviews.llvm.org/rL277638 https://reviews.llvm.org/rL277629 llvm-svn: 277779
* [InstCombine] use m_APInt to allow icmp eq (and X, C1), C2 folds for splat ↵Sanjay Patel2016-08-041-14/+9
| | | | | | constant vectors llvm-svn: 277762
* [InstCombine] use m_APInt to allow icmp eq (or X, C1), C2 folds for splat ↵Sanjay Patel2016-08-041-9/+7
| | | | | | constant vectors llvm-svn: 277752
* [InstCombine] use m_APInt to allow icmp eq (op X, Y), C folds for splat ↵Sanjay Patel2016-08-041-11/+0
| | | | | | | | | constant vectors I'm removing a misplaced pair of more specific folds from InstCombine in this patch as well, so we know where those folds are happening in InstSimplify. llvm-svn: 277738
* [InstCombine] use m_APInt to allow icmp eq (sub C1, X), C2 folds for splat ↵Sanjay Patel2016-08-041-4/+4
| | | | | | constant vectors llvm-svn: 277731
* Add popcount(n) == bitsize(n) -> n == -1 transformation.Amaury Sechet2016-08-041-4/+10
| | | | | | | | | | | | Summary: As per title. Reviewers: majnemer, spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D23139 llvm-svn: 277694
* [InstCombine] use m_APInt to allow icmp eq (add X, C1), C2 folds for splat ↵Sanjay Patel2016-08-031-6/+8
| | | | | | constant vectors llvm-svn: 277659
* [InstCombine] use m_APInt to allow icmp eq (srem X, C1), C2 folds for splat ↵Sanjay Patel2016-08-031-4/+3
| | | | | | constant vectors llvm-svn: 277638
* [InstCombine] use m_APInt to allow icmp (binop X, Y), C folds with constant ↵Sanjay Patel2016-08-031-14/+20
| | | | | | | | | splat vectors This removes the restriction for the icmp constant, but as noted by the FIXME comments, we still need to change individual checks for binop operand constants. llvm-svn: 277629
* use local variables; NFCSanjay Patel2016-08-031-29/+23
| | | | llvm-svn: 277612
* [InstCombine] replace dyn_casts with matches; NFCISanjay Patel2016-08-021-13/+14
| | | | | | Clean-up before changing this to allow folds for vectors. llvm-svn: 277538
* [InstCombine] allow icmp (bit-manipulation-intrinsic(), C) folds for vectorsSanjay Patel2016-07-231-13/+16
| | | | llvm-svn: 276523
* [InstCombine] move udiv+cmp fold over with other BinOp+cmp folds; NFCISanjay Patel2016-07-231-9/+8
| | | | llvm-svn: 276502
* [InstCombine] break up foldICmpEqualityWithConstant(); NFCISanjay Patel2016-07-211-148/+159
| | | | | | | Almost all of these folds require changes to allow vector types. Splitting up the logic should make that easier to do incrementally. llvm-svn: 276360
* make InstCombine compare helper functions private; NFCSanjay Patel2016-07-211-45/+45
| | | | | | Also, rename some of them for consistency and to follow current conventions. llvm-svn: 276312
OpenPOWER on IntegriCloud