summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/or.ll
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Temporarily Revert "Add basic loop fusion pass.""Eric Christopher2019-04-171-0/+843
| | | | | | | | The reversion apparently deleted the test/Transforms directory. Will be re-reverting again. llvm-svn: 358552
* Temporarily Revert "Add basic loop fusion pass."Eric Christopher2019-04-171-843/+0
| | | | | | | | As it's causing some bot failures (and per request from kbarton). This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda. llvm-svn: 358546
* [NFC][InstCombine] Regenerate two tests that are affected by folding masked ↵Roman Lebedev2018-04-201-61/+61
| | | | | | merge llvm-svn: 330415
* [InstCombine] move related tests together; NFC Sanjay Patel2017-09-121-12/+0
| | | | llvm-svn: 313036
* [InstCombine] Make (X|C1)^C2 -> X^(C1^C2) iff X&~C1 == 0 work for splat vectorsCraig Topper2017-08-101-0/+13
| | | | | | | | This also corrects the description to match what was actually implemented. The old comment said X^(C1|C2), but it implemented X^((C1|C2)&~(C1&C2)). I believe ((C1|C2)&~(C1&C2)) is equivalent to (C1^C2). Differential Revision: https://reviews.llvm.org/D36505 llvm-svn: 310658
* [InstCombine] Fix a crash in getSelectCondition if we happen to have two ↵Craig Topper2017-08-101-0/+12
| | | | | | | | inverse vectors of i1 constants. We used to try to truncate the constant vector to vXi1, but if it's already i1 this would fail. Instead we now use IRBuilder::getZExtOrTrunc which should check the type and only create a trunc if needed. I believe this should trigger constant folding in the IRBuilder and ultimately do the same thing just with the additional type check. llvm-svn: 310639
* [InstCombine] Support (X | C1) & C2 --> (X & C2^(C1&C2)) | (C1&C2) for ↵Craig Topper2017-08-071-0/+31
| | | | | | | | | | | | vector splats Note the original code I deleted incorrectly listed this as (X | C1) & C2 --> (X & C2^(C1&C2)) | C1 Which is only valid if C1 is a subset of C2. This relied on SimplifyDemandedBits to remove any extra bits from C1 before we got to that code. My new implementation avoids relying on that behavior so that it can be naively verified with alive. Differential Revision: https://reviews.llvm.org/D36384 llvm-svn: 310272
* [InstCombine] Improve the expansion in SimplifyUsingDistributiveLaws to ↵Craig Topper2017-07-151-32/+16
| | | | | | | | | | | | | | | | | | | handle cases where one side doesn't simplify, but the other side resolves to an identity value Summary: If one side simplifies to the identity value for inner opcode, we can replace the value with just the operation that can't be simplified. I've removed a couple now unneeded special cases in visitAnd and visitOr. There are probably other cases I missed. Reviewers: spatel, majnemer, hfinkel, dberlin Reviewed By: spatel Subscribers: grandinj, llvm-commits, spatel Differential Revision: https://reviews.llvm.org/D35451 llvm-svn: 308111
* [InstCombine] Add test cases for (X & (Y | ~X)) -> (X & Y) where the not is ↵Craig Topper2017-07-151-0/+159
| | | | | | | | an inverted compare. NFC Do the same for (X | (Y & ~X)) -> (X | Y) llvm-svn: 308104
* [InstCombine] remove dead code/tests; NFCISanjay Patel2017-07-151-54/+0
| | | | | | | These patterns and tests were added to InstSimplify with: https://reviews.llvm.org/rL303004 llvm-svn: 308096
* [InstCombine] put tests for commuted variants of the same fold together; NFCSanjay Patel2017-07-131-44/+66
| | | | llvm-svn: 307951
* [InstSimplify, InstCombine] move 'or' simplification tests; NFCSanjay Patel2017-05-101-109/+0
| | | | | | | Surprisingly, I don't think these are redundant for InstSimplify. They were just misplaced as InstCombine tests. llvm-svn: 302684
* [InstSimplify] use ConstantRange to simplify or-of-icmpsSanjay Patel2017-05-071-11/+0
| | | | | | | | | | | | | We can simplify (or (icmp X, C1), (icmp X, C2)) to 'true' or one of the icmps in many cases. I had to check some of these with Alive to prove to myself it's right, but everything seems to check out. Eg, the deleted code in instcombine was completely ignoring predicates with mismatched signedness. This is a follow-up to: https://reviews.llvm.org/rL301260 https://reviews.llvm.org/D32143 llvm-svn: 302370
* [InstSimplify] move (A & ~B) | (A ^ B) -> (A ^ B) from InstCombineSanjay Patel2017-04-241-53/+0
| | | | | | | | | | | This is a straight cut and paste, but there's a bigger problem: if this fold exists for simplifyOr, there should be a DeMorganized version for simplifyAnd. But more than that, we have a patchwork of ad hoc logic optimizations in InstCombine. There should be some structure to ensure that we're not missing sibling folds across and/or/xor. llvm-svn: 301213
* [InstCombine] add/move tests for and/or-of-icmps equality folds; NFCSanjay Patel2017-04-141-74/+0
| | | | llvm-svn: 300357
* [InstCombine] fold X == 0 || X == -1 to one compare (PR32524)Sanjay Patel2017-04-131-4/+3
| | | | | | | | | | | | | | | | This is effectively a retry of: https://reviews.llvm.org/rL299851 but now we have tests and an assert to make sure the bug that was exposed with that attempt will not happen again. I'll fix the code duplication and missing sibling fold next, but I want to make this change as small as possible to reduce risk since I messed it up last time. This should fix: https://bugs.llvm.org/show_bug.cgi?id=32524 llvm-svn: 300236
* [InstCombine] add/move tests for or-of-icmps; NFCSanjay Patel2017-04-131-13/+61
| | | | | | | 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
* revert r299851 - [InstCombine] fix matching of or-of-icmps constants (PR32524)Sanjay Patel2017-04-111-3/+4
| | | | | | This is a candidate culprit for multiple bot fails, so reverting pending investigation. llvm-svn: 299955
* [InstCombine] fix matching of or-of-icmps constants (PR32524)Sanjay Patel2017-04-101-4/+3
| | | | | | | | | | | Also, make the same change in and-of-icmps and remove a hack for detecting that case. Finally, add some FIXME comments because the code duplication here is awful. This should fix the remaining IR problem noted in: https://bugs.llvm.org/show_bug.cgi?id=32524 llvm-svn: 299851
* [InstCombine] add test for PR32524; NFCSanjay Patel2017-04-101-1/+15
| | | | llvm-svn: 299846
* [InstCombine] Handle more commuted cases of ((A & B) | ~A) -> (~A | B)Craig Topper2017-04-071-4/+2
| | | | llvm-svn: 299747
* [InstCombine] Add additional tests with varied commuting to show missing ↵Craig Topper2017-04-071-0/+38
| | | | | | combines. NFC llvm-svn: 299746
* [InstCombine] Add more commuted patterns to support folding ((~A & B) | A) ↵Craig Topper2017-04-071-10/+4
| | | | | | -> (A | B). llvm-svn: 299737
* [InstCombine] Add a few cases for OR we fail to optimize due to missing ↵Craig Topper2017-04-061-0/+45
| | | | | | commuted patterns checks. llvm-svn: 299725
* [InstCombine] Support folding and/or/xor with a constant vector RHS into ↵Craig Topper2017-04-041-10/+6
| | | | | | | | | | selects and phis Currently we only fold with ConstantInt RHS. This generalizes to any Constant RHS. Differential Revision: https://reviews.llvm.org/D31610 llvm-svn: 299466
* [InstCombine] Add test cases for missing combines of phis with and/or/xor ↵Craig Topper2017-04-041-0/+68
| | | | | | with constant argument. NFC llvm-svn: 299460
* [InstCombine] Add more test cases for missing combines of selects with ↵Craig Topper2017-04-041-0/+11
| | | | | | and/or/xor with constant argument. NFC llvm-svn: 299450
* [InstCombine] Add test cases showing how we fail to fold vector constants ↵Craig Topper2017-04-031-0/+21
| | | | | | into selects the way we do with scalars. llvm-svn: 299369
* [InstCombine] fix operand-complexity-based canonicalization (PR28296)Sanjay Patel2017-02-031-1/+1
| | | | | | | | | | | | | | | | | | | 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 commutative matcher for pattern with commutative operatorsSanjay Patel2016-12-191-1/+16
| | | | | | | | This is a case that was missed in: https://reviews.llvm.org/rL290067 ...and it would regress if we fix operand complexity (PR28296). llvm-svn: 290127
* [InstCombine] use commutative matchers for patterns with commutative operatorsSanjay Patel2016-12-181-18/+5
| | | | | | | | | | | | | | | | | | | | | | | | Background/motivation - I was circling back around to: https://llvm.org/bugs/show_bug.cgi?id=28296 I made a simple patch for that and noticed some regressions, so added test cases for those with rL281055, and this is hopefully the minimal fix for just those cases. But as you can see from the surrounding untouched folds, we are missing commuted patterns all over the place, and of course there are no regression tests to cover any of those cases. We could sprinkle "m_c_" dust all over this file and catch most of the missing folds, but then we still wouldn't have test coverage, and we'd still miss some fraction of commuted patterns because they require adjustments to the match order. I'm aware of the concern about the potential compile-time performance impact of adding matches like this (currently being discussed on llvm-dev), but I don't think there's any evidence yet to suggest that handling commutative pattern matching more thoroughly is not a worthwhile goal of InstCombine. Differential Revision: https://reviews.llvm.org/D24419 llvm-svn: 290067
* [InstCombine] add tests to show pattern matching failures due to commutationSanjay Patel2016-09-091-0/+55
| | | | | | | 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] add tests to show type limitations of InsertRangeTest and callersSanjay Patel2016-08-301-1/+14
| | | | llvm-svn: 280175
* [InstCombine] use m_APInt to allow icmp (or X, Y), C folds for splat ↵Sanjay Patel2016-08-171-8/+6
| | | | | | | | | | constant vectors This is a sibling of: https://reviews.llvm.org/rL278859 https://reviews.llvm.org/rL278935 llvm-svn: 278945
* [InstCombine] add tests for missing vector icmp foldsSanjay Patel2016-08-171-0/+30
| | | | llvm-svn: 278943
* [InstCombine] check for one-use before turning simple logic op into a selectSanjay Patel2016-07-081-3/+1
| | | | llvm-svn: 274891
* add test to show multi-use outputSanjay Patel2016-07-081-0/+15
| | | | llvm-svn: 274887
* [InstCombine] allow or(sext(A), B) --> A ? -1 : B transform for vectorsSanjay Patel2016-07-081-4/+2
| | | | llvm-svn: 274883
* add vector tests to show missing transformSanjay Patel2016-07-081-0/+22
| | | | llvm-svn: 274876
* minimize testsSanjay Patel2016-07-081-16/+8
| | | | | | The cmp and load aren't required. llvm-svn: 274864
* regenerate checksSanjay Patel2016-07-081-256/+318
| | | | llvm-svn: 274860
* Do (A == C1 || A == C2) -> (A & ~(C1 ^ C2)) == C1 rather than (A == C1 || A ↵David Majnemer2015-12-021-1/+1
| | | | | | | | | | == C2) -> (A | (C1 ^ C2)) == C2 when C1 ^ C2 is a power of 2. Differential Revision: http://reviews.llvm.org/D14223 Patch by Amaury SECHET! llvm-svn: 254518
* [opaque pointer type] Add textual IR support for explicit type parameter to ↵David Blaikie2015-02-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | load instruction Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 llvm-svn: 230794
* InstCombine: FoldOrOfICmps harderDavid Majnemer2014-11-281-0/+10
| | | | | | | | | | | | We may be in a situation where the icmps might not be near each other in a tree of or instructions. Try to dig out related compare instructions and see if they combine. N.B. This won't fire on deep trees of compares because rewritting the tree might end up creating a net increase of IR. We may have to resort to something more sophisticated if this is a real problem. llvm-svn: 222928
* New InstCombine pattern: (icmp ult/ule (A + C1), C3) | (icmp ult/ule (A + ↵Yi Jiang2014-08-201-0/+26
| | | | | | C2), C3) to (icmp ult/ule ((A & ~(C1 ^ C2)) + max(C1, C2)), C3) under certain condition llvm-svn: 216135
* Added InstCombine Transform for ((B | C) & A) | B -> B | (A & C)David Majnemer2014-08-141-0/+11
| | | | | | | | | | | | Transform ((B | C) & A) | B --> B | (A & C) Z3 Link: http://rise4fun.com/Z3/hP6p Patch by Sonam Kumari! Differential Revision: http://reviews.llvm.org/D4865 llvm-svn: 215619
* This patch implements transform for pattern "( A & (~B)) | (A ^ B) -> (A ^ B)"Suyog Sarda2014-08-011-0/+20
| | | | | | Differential Revision: http://reviews.llvm.org/D4652 llvm-svn: 214477
* This patch implements transform for pattern "(A & B) | ((~A) ^ B) -> (~A ^ B)".Suyog Sarda2014-08-011-0/+22
| | | | | | | | Patch Credit to Ankit Jain ! Differential Revision: http://reviews.llvm.org/D4655 llvm-svn: 214476
* Added InstCombine Transform for patterns: Suyog Sarda2014-07-221-0/+19
| | | | | | | | | | "((~A & B) | A) -> (A | B)" and "((A & B) | ~A) -> (~A | B)" Original Patch credit to Ankit Jain !! Differential Revision: http://reviews.llvm.org/D4591 llvm-svn: 213676
* Update Transforms tests to use CHECK-LABEL for easier debugging. No ↵Stephen Lin2013-07-141-39/+39
| | | | | | | | | | | | | | | | | | | | | | functionality change. This update was done with the following bash script: find test/Transforms -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3@$FUNC(/g" $TEMP done mv $TEMP $NAME fi done llvm-svn: 186268
OpenPOWER on IntegriCloud