summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/or.ll
Commit message (Collapse)AuthorAge
* Update Transforms tests to use CHECK-LABEL for easier debugging. No ↵Stephen Lin2013-07-14
| | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186268 91177308-0d34-0410-b5e6-96231b3b80d8
* Reorders two transforms that collide with each otherDavid Majnemer2013-04-14
| | | | | | | | | | | | | | | | | | | | | | | One performs: (X == 13 | X == 14) -> X-13 <u 2 The other: (A == C1 || A == C2) -> (A & ~(C1 ^ C2)) == C1 The problem is that there are certain values of C1 and C2 that trigger both transforms but the first one blocks out the second, this generates suboptimal code. Reordering the transforms should be better in every case and allows us to do interesting stuff like turn: %shr = lshr i32 %X, 4 %and = and i32 %shr, 15 %add = add i32 %and, -14 %tobool = icmp ne i32 %add, 0 into: %and = and i32 %X, 240 %tobool = icmp ne i32 %and, 224 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179493 91177308-0d34-0410-b5e6-96231b3b80d8
* The transform is:Bill Wendling2013-02-16
| | | | | | | | | | | | | | | | (or (bool?A:B),(bool?C:D)) --> (bool?(or A,C):(or B,D)) By the time the OR is visited, both the SELECTs have been visited and not optimized and the OR itself hasn't been transformed so we do this transform in the hopes that the new ORs will be optimized. The transform is explicitly disabled for vector-selects until "codegen matures to handle them better". Patch by Muhammad Tauqir! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175380 91177308-0d34-0410-b5e6-96231b3b80d8
* More instcombine cleanup, towards improving debug line info.Eli Friedman2011-05-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131604 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an instcombine for constructs like a | -(b != c); a select is moreEli Friedman2011-04-14
| | | | | | | | | canonical, and generally leads to better code. Found while looking at an article about saturating arithmetic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129545 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach InstCombine to merge (icmp ult (X + CA), C1) | (icmp eq X, C2) into ↵Benjamin Kramer2010-12-20
| | | | | | | | | | | | | | | | (icmp ult (X + CA), C1 + 1) if C2 + CA == C1. InstCombine creates these so now we compile x == 23 || x == 24 || x == 25 to %x.off = add i32 %x, -23 %1 = icmp ult i32 %x.off, 3 instead of %x.off = add i32 %x, -23 %1 = icmp ult i32 %x.off, 2 %cmp3 = icmp eq i32 %x, 25 %ret2 = or i1 %1, %cmp3 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122248 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-apply r113679, which was reverted in r113720, which added a paid of new ↵Owen Anderson2010-09-13
| | | | | | | | | | instcombine transforms to expose greater opportunities for store narrowing in codegen. This patch fixes a potential infinite loop in instcombine caused by one of the introduced transforms being overly aggressive. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113763 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 113679, it was causing an infinite loop in a testcase that I've sentEric Christopher2010-09-12
| | | | | | | on to Owen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113720 91177308-0d34-0410-b5e6-96231b3b80d8
* Invert and-of-or into or-of-and when doing so would allow us to clear bits ↵Owen Anderson2010-09-11
| | | | | | | | | | | | | | | of the and's mask. This can result in increased opportunities for store narrowing in code generation. Update a number of tests for this change. This fixes <rdar://problem/8285027>. Additionally, because this inverts the order of ors and ands, some patterns for optimizing or-of-and-of-or no longer fire in instances where they did originally. Add a simple transform which recaptures most of these opportunities: if we have an or-of-constant-or and have failed to fold away the inner or, commute the order of the two ors, to give the non-constant or a chance for simplification instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113679 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach InstructionSimplify to fold (A & B) & A -> A & B and (A | B) | A -> A | B.Benjamin Kramer2010-09-10
| | | | | | | Reassociate does this but it doesn't catch all cases (e.g. if the operands are i1). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113651 91177308-0d34-0410-b5e6-96231b3b80d8
* revert r108320, I see the failures now...Chris Lattner2010-07-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108322 91177308-0d34-0410-b5e6-96231b3b80d8
* reapply benjamin's instcombine patch, I don't see anything wrong with it and ↵Chris Lattner2010-07-14
| | | | | | can't repro any problems with a manual self-host. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108320 91177308-0d34-0410-b5e6-96231b3b80d8
* Nope, still breaks the release selfhost bots :(Benjamin Kramer2010-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108153 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply the "or" half of r108136, which seems to be less problematic.Benjamin Kramer2010-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108152 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r108141 again, sigh.Benjamin Kramer2010-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108148 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply 108136 with an ugly pasto fixed.Benjamin Kramer2010-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108141 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r108136 until I figure out why it broke selfhost.Benjamin Kramer2010-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108139 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: fold (x & y) | (~x & z) and (x & y) ^ (~x & z) into ((y ^ z) & ↵Benjamin Kramer2010-07-12
| | | | | | | | | | | | | | | | | | x) ^ z which is one instruction shorter. (PR6773) before: %and = and i32 %y, %x %neg = xor i32 %x, -1 %and4 = and i32 %z, %neg %xor = xor i32 %and4, %and after: %xor1 = xor i32 %z, %y %and2 = and i32 %xor1, %x %xor = xor i32 %and2, %z git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108136 91177308-0d34-0410-b5e6-96231b3b80d8
* make these less sensitive to temporary naming.Chris Lattner2010-03-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97799 91177308-0d34-0410-b5e6-96231b3b80d8
* don't turn (A & (C0?-1:0)) | (B & ~(C0?-1:0)) -> C0 ? A : BChris Lattner2010-02-02
| | | | | | | | for vectors. Codegen is generating awful code or segfaulting in various cases (e.g. PR6204). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95058 91177308-0d34-0410-b5e6-96231b3b80d8
* add one more bitfield optimization, allowing clang to generateChris Lattner2010-01-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | good code on PR4216: _test_bitfield: ## @test_bitfield orl $32962, %edi movl $4294941946, %eax andq %rdi, %rax ret instead of: _test_bitfield: movl $4294941696, %ecx movl %edi, %eax orl $194, %edi orl $32768, %eax andq $250, %rdi andq %rax, %rcx movq %rdi, %rax orq %rcx, %rax ret Evan is looking into the remaining andq+imm -> andl optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93147 91177308-0d34-0410-b5e6-96231b3b80d8
* implement an instcombine xform needed by clang's codegenChris Lattner2010-01-04
| | | | | | | | | on the example in PR4216. This doesn't trigger in the testsuite, so I'd really appreciate someone scrutinizing the logic for correctness. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92458 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix logic error in previous commit. The != case needs to become an or, not anNick Lewycky2010-01-02
| | | | | | | and. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92419 91177308-0d34-0410-b5e6-96231b3b80d8
* Optimize pointer comparison into the typesafe form, now that the backends willNick Lewycky2010-01-02
| | | | | | | | handle them efficiently. This is the opposite direction of the transformation we used to have here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92418 91177308-0d34-0410-b5e6-96231b3b80d8
* remove the instcombine transformations that are inserting nastyChris Lattner2010-01-02
| | | | | | | | | | | | pointer to int casts that confuse later optimizations. See PR3351 for details. This improves but doesn't complete fix 483.xalancbmk because llvm-gcc does this xform in GCC's "fold" routine as well. Clang++ will do better I guess. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92408 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement PR5634.Chris Lattner2009-11-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90046 91177308-0d34-0410-b5e6-96231b3b80d8
* reapply r85085 with a bugfix to avoid infinite looping.Chris Lattner2009-10-26
| | | | | | | | All of the 'demorgan' related xforms need to use dyn_castNotVal, not m_Not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85119 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 85085. It causes infinite looping during llvm-gcc build.Evan Cheng2009-10-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85090 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement PR3266 & PR5276, folding:Chris Lattner2009-10-26
| | | | | | | | not (or (icmp, icmp)) -> and(icmp, icmp) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85085 91177308-0d34-0410-b5e6-96231b3b80d8
* convert or.ll to filecheck and merge or2 into it.Chris Lattner2009-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85083 91177308-0d34-0410-b5e6-96231b3b80d8
* Change tests from "opt %s" to "opt < %s" so that opt doesn't see theDan Gohman2009-09-11
| | | | | | | | | input filename so that opt doesn't print the input filename in the output so that grep lines in the tests don't unintentionally match strings in the input filename. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81537 91177308-0d34-0410-b5e6-96231b3b80d8
* Use opt -S instead of piping bitcode output through llvm-dis.Dan Gohman2009-09-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81257 91177308-0d34-0410-b5e6-96231b3b80d8
* Change these tests to feed the assembly files to opt directly, insteadDan Gohman2009-09-08
| | | | | | | of using llvm-as, now that opt supports this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81226 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove llvm-upgrade and update test cases.Tanya Lattner2008-03-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47793 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1319:Reid Spencer2007-04-15
| | | | | | | | Make use of the END. facility on all files > 1K so that we aren't wasting CPU cycles searching for RUN: lines that we'll never find. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36059 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1319:Reid Spencer2007-04-14
| | | | | | | Upgrade tests to work with new llvm.exp version of llvm_runtest. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36013 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the llvm-upgrade program to upgrade llvm assembly.Reid Spencer2006-12-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32115 91177308-0d34-0410-b5e6-96231b3b80d8
* new testcaseChris Lattner2006-02-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26384 91177308-0d34-0410-b5e6-96231b3b80d8
* tweaksChris Lattner2006-02-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26133 91177308-0d34-0410-b5e6-96231b3b80d8
* new testcaseChris Lattner2005-09-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23375 91177308-0d34-0410-b5e6-96231b3b80d8
* new testcaseChris Lattner2005-05-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21708 91177308-0d34-0410-b5e6-96231b3b80d8
* New testcaseChris Lattner2004-09-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16560 91177308-0d34-0410-b5e6-96231b3b80d8
* Renamed `as' => `llvm-as', `dis' => `llvm-dis', `link' => `llvm-link'.Misha Brukman2003-09-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8558 91177308-0d34-0410-b5e6-96231b3b80d8
* New testcasesChris Lattner2003-08-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7781 91177308-0d34-0410-b5e6-96231b3b80d8
* More testcases, which I'll implement laterChris Lattner2003-07-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7298 91177308-0d34-0410-b5e6-96231b3b80d8
* New testcaseChris Lattner2003-07-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7296 91177308-0d34-0410-b5e6-96231b3b80d8
* Renumber tests sequentiallyChris Lattner2003-07-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7280 91177308-0d34-0410-b5e6-96231b3b80d8
* Split the or and xor tests into two separate filesChris Lattner2003-07-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7279 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove obscure testChris Lattner2003-07-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7278 91177308-0d34-0410-b5e6-96231b3b80d8
* New testcaseChris Lattner2003-07-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7267 91177308-0d34-0410-b5e6-96231b3b80d8