summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine
Commit message (Collapse)AuthorAgeFilesLines
* InstCombine: Don't combine loads/stores from swifterror to a new typeArnold Schwaighofer2016-09-102-0/+33
| | | | | | | | | This generates invalid IR: the only users of swifterror can be call arguments, loads, and stores. rdar://28242257 llvm-svn: 281144
* [InstCombine] use m_APInt to allow icmp ult X, C folds for splat constant ↵Sanjay Patel2016-09-094-10/+14
| | | | | | vectors llvm-svn: 281107
* [InstCombine] add tests to show pattern matching failures due to commutationSanjay Patel2016-09-093-0/+148
| | | | | | | I was looking to fix a bug in getComplexity(), and these cases showed up as obvious failures. I'm not sure how to find these in general though. llvm-svn: 281055
* [InstCombine] regenerate checksSanjay Patel2016-09-081-228/+284
| | | | llvm-svn: 280993
* [InstCombine] regenerate checksSanjay Patel2016-09-081-60/+77
| | | | llvm-svn: 280991
* [InstCombine][X86] Regenerate masked memory op combine testsSimon Pilgrim2016-09-081-88/+114
| | | | llvm-svn: 280960
* [InstCombine][X86] Regenerate vperm2f128/vperm2i128 combine testsSimon Pilgrim2016-09-081-86/+116
| | | | llvm-svn: 280959
* [InstCombine][X86] Regenerate insertps combine testsSimon Pilgrim2016-09-081-43/+59
| | | | llvm-svn: 280957
* [InstCombine] use m_APInt to allow icmp (and (sh X, Y), C2), C1 folds for ↵Sanjay Patel2016-09-074-15/+9
| | | | | | 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
* Regenerate vector bitcast folding tests using update_test_checks.py.Andrea Di Biagio2016-09-072-108/+0
| | | | | | | Two tests have been merged together, regenerated and then moved to a more appropriate directory. No functional change. llvm-svn: 280814
* [InstCombine][SSE4a] Fix assertion failure in the insertq/insertqi combining ↵Andrea Di Biagio2016-09-071-0/+18
| | | | | | | | | | | logic. This fixes a similar issue to the one already fixed by r280804 (revieved in D24256). Revision 280804 fixed the problem with unsafe dyn_casts in the extrq/extrqi combining logic. However, it turns out that even the insertq/insertqi logic was affected by the same problem. llvm-svn: 280807
* [InstCombine][SSE4a] Fix assertion failure caused by unsafe dyn_casts on the ↵Andrea Di Biagio2016-09-071-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | operands of extrq/extrqi intrinsic calls. This patch fixes an assertion failure caused by unsafe dynamic casts on the constant operands of sse4a intrinsic calls to extrq/extrqi The combine logic that simplifies sse4a extrq/extrqi intrinsic calls currently checks if the input operands are constants. Internally, that logic relies on dyn_casts of values returned by calls to method Constant::getAggregateElement. However, method getAggregateElemet may return nullptr if the constant element cannot be retrieved. So, all the dyn_casts can potentially fail. This is what happens for example if a constexpr value is passed in input to an extrq/extrqi intrinsic call. This patch fixes the problem by using a dyn_cast_or_null (instead of a simple dyn_cast) on the result of each call to Constant::getAggregateElement. Added reproducible test cases to x86-sse4a.ll. Differential Revision: https://reviews.llvm.org/D24256 llvm-svn: 280804
* fix FileCheck variables for test added with r280677Sanjay Patel2016-09-051-2/+2
| | | | | | | The script (utils/update_test_checks.py) seems to have problems with variable names that start with the same string. llvm-svn: 280679
* [InstCombine] don't assert that division-by-constant has been folded (PR30281)Sanjay Patel2016-09-051-0/+93
| | | | | | | | | | 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
* [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] Preserve llvm.mem.parallel_loop_access metadata when replacingDorit Nuzman2016-09-041-0/+61
| | | | | | | | | | | | memcpy with ld/st. When InstCombine replaces a memcpy with loads+stores it does not copy over the llvm.mem.parallel_loop_access from the memcpy instruction. This patch fixes that. Differential Revision: https://reviews.llvm.org/D23499 llvm-svn: 280617
* AMDGPU: Do basic folding of class intrinsicMatt Arsenault2016-09-031-0/+237
| | | | | | | This allows more of the OCML builtin library to be constant folded. llvm-svn: 280586
* Fix buildbot error.Wei Mi2016-09-031-62/+0
| | | | | | Add -mtriple=x86_64-unknown-linux-gnu for the test and move it to CodeGen/X86. llvm-svn: 280568
* [InstCombine] auto-generate assertions for tighter checkingSanjay Patel2016-09-021-60/+95
| | | | llvm-svn: 280531
* Split the store of a wide value merged from an int-fp pair into multiple stores.Wei Mi2016-09-021-0/+62
| | | | | | | | | | | | | | For the store of a wide value merged from a pair of values, especially int-fp pair, sometimes it is more efficent to split it into separate narrow stores, which can remove the bitwise instructions or sink them to colder places. Now the feature is only enabled on x86 target, and only store of int-fp pair is splitted. It is possible that the application scope gets extended with perf evidence support in the future. Differential Revision: https://reviews.llvm.org/D22840 llvm-svn: 280505
* [InsttCombine] fold insertelement of constant into shuffle with constant ↵Sanjay Patel2016-09-021-7/+4
| | | | | | | | | | | | | | | | | operand (PR29126) The motivating case occurs with SSE/AVX scalar intrinsics, so this is a first step towards shrinking that to a single shufflevector. Note that the transform is intentionally limited to shuffles that are equivalent to vector selects to avoid creating arbitrary shuffle masks that may not lower well. This should solve PR29126: https://llvm.org/bugs/show_bug.cgi?id=29126 Differential Revision: https://reviews.llvm.org/D23886 llvm-svn: 280504
* [InstCombine] Add test for insertelementinsts with constants.Alexey Bataev2016-09-021-0/+77
| | | | | | | Added a tests that shows that several insertelementinsts with constant indexes/data are not folded into a single shuffleinst. llvm-svn: 280474
* [InstCombine] add tests to show potential shuffle+insert foldsSanjay Patel2016-09-011-0/+112
| | | | llvm-svn: 280403
* [InstCombine] remove fold of an icmp pattern that should never happenSanjay Patel2016-09-011-0/+15
| | | | | | | | | | | | 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
* [InstCombine] allow icmp (shr exact X, C2), C fold for splat constant vectorsSanjay Patel2016-08-311-3/+1
| | | | | | | 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
* [InstCombine] allow icmp (div X, Y), C folds for splat constant vectorsSanjay Patel2016-08-314-44/+27
| | | | | | Converting all of the overflow ops to APInt looked risky, so I've left that as a TODO. llvm-svn: 280299
* [InstCombine] add tests to show type limitations of InsertRangeTest and callersSanjay Patel2016-08-303-3/+56
| | | | llvm-svn: 280175
* [InstCombine] use m_APInt to allow icmp (and X, Y), C folds for splat ↵Sanjay Patel2016-08-284-18/+8
| | | | | | constant vectors llvm-svn: 279937
* [Profile] Propagate branch metadata properly in instcombineXinliang David Li2016-08-251-0/+135
| | | | | | Differential Revision: http://reviews.llvm.org/D23590 llvm-svn: 279693
* [InstCombine] use m_APInt to allow icmp eq/ne (shr X, C2), C folds for splat ↵Sanjay Patel2016-08-244-22/+32
| | | | | | 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] Allow sinking from unique predecessor with multiple edgesJun Bum Lim2016-08-221-0/+23
| | | | | | | | | | | | Summary: We can allow sinking if the single user block has only one unique predecessor, regardless of the number of edges. Note that a switch statement with multiple cases can have the same destination. Reviewers: mcrosier, majnemer, spatel, reames Subscribers: reames, mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D23722 llvm-svn: 279448
* [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
* remove FIXME comment; fixed by previous commitSanjay Patel2016-08-211-1/+0
| | | | llvm-svn: 279400
* [InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat ↵Sanjay Patel2016-08-211-2/+2
| | | | | | | | 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-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-192-16/+20
| | | | | | | | | 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
* Make cltz and cttz zero undef when the operand cannot be zero in InstCombineAmaury Sechet2016-08-181-0/+20
| | | | | | | | | | | | Summary: Also add popcount(n) == bitsize(n) -> n == -1 transformation. Reviewers: majnemer, spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D23134 llvm-svn: 279141
* [InstCombine] use m_APInt to allow icmp (trunc X, Y), C folds for splat ↵Sanjay Patel2016-08-182-11/+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] use m_APInt to allow icmp (udiv X, Y), C folds for splat ↵Sanjay Patel2016-08-181-16/+7
| | | | | | | | | | | | | 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] 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-184-16/+6
| | | | | | | | | | | 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
OpenPOWER on IntegriCloud