summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/select.ll
Commit message (Collapse)AuthorAgeFilesLines
...
* InstCombine: Make switch folding with equality compares more aggressive by ↵Benjamin Kramer2011-05-271-0/+40
| | | | | | | | trying instsimplify on the arm where we know the compared value. Stuff like "x == y ? y : x&y" now folds into "x&y". llvm-svn: 132185
* Teach the transformation that moves binary operators around selects to preserveNick Lewycky2011-03-271-0/+12
| | | | | | the subclass optional data. llvm-svn: 128388
* Add a small missed optimization: turn X == C ? X : Y into X == C ? C : Y. ThisNick Lewycky2011-03-271-0/+13
| | | | | | | | | | removes one use of X which helps it pass the many hasOneUse() checks. In my analysis, this turns up very often where X = A >>exact B and that can't be simplified unless X has one use (except by increasing the lifetime of A which is generally a performance loss). llvm-svn: 128373
* InstCombine: Fix a thinko where transform an icmp under the assumption that ↵Benjamin Kramer2011-03-111-0/+10
| | | | | | | | it's a zero comparison when it's not. Fixes PR9454. llvm-svn: 127464
* Clean up the tests a little, make sure we match an instruction in the rightNick Lewycky2011-01-281-5/+4
| | | | | | test. llvm-svn: 124473
* Fold select + select where both selects are on the same condition.Nick Lewycky2011-01-281-1/+16
| | | | llvm-svn: 124469
* Don't try to pull vector bitcasts that change the number of elements throughNick Lewycky2011-01-211-0/+11
| | | | | | | a select. A vector select is pairwise on each element so we'd need a new condition with the right number of elements to select on. Fixes PR8994. llvm-svn: 123963
* Instcombine: Fix pattern where the sext did not dominate the icmp using itTobias Grosser2011-01-091-0/+11
| | | | llvm-svn: 123121
* InstCombine: Match min/max hidden by sext/zextTobias Grosser2011-01-071-0/+82
| | | | | | | | | | | | | | | X = sext x; x >s c ? X : C+1 --> X = sext x; X <s C+1 ? C+1 : X X = sext x; x <s c ? X : C-1 --> X = sext x; X >s C-1 ? C-1 : X X = zext x; x >u c ? X : C+1 --> X = zext x; X <u C+1 ? C+1 : X X = zext x; x <u c ? X : C-1 --> X = zext x; X >u C-1 ? C-1 : X X = sext x; x >u c ? X : C+1 --> X = sext x; X <u C+1 ? C+1 : X X = sext x; x <u c ? X : C-1 --> X = sext x; X >u C-1 ? C-1 : X Instead of calculating this with mixed types promote all to the larger type. This enables scalar evolution to analyze this expression. PR8866 llvm-svn: 123034
* InstCombine: creating selects from -1 and 0 is fine, they combine into a ↵Benjamin Kramer2010-12-221-0/+12
| | | | | | sext from i1. llvm-svn: 122453
* Make this test not depend on how the variable is named.Duncan Sands2010-12-221-2/+2
| | | | llvm-svn: 122413
* Generalize the and-icmp-select instcombine further by allowing selects of ↵Benjamin Kramer2010-12-111-0/+50
| | | | | | | | | | | the form (x & 2^n) ? 2^m+C : C we can offset both arms by C to get the "(x & 2^n) ? 2^m : 0" form, optimize the select to a shift and apply the offset afterwards. llvm-svn: 121609
* Factor the (x & 2^n) ? 2^m : 0 instcombine into its own method and generalize itBenjamin Kramer2010-12-111-0/+25
| | | | | | to catch cases where n != m with a shift. llvm-svn: 121608
* Move PHI tests to phi.ll, out of select.ll.Duncan Sands2010-11-151-49/+2
| | | | llvm-svn: 119153
* Generalize the reassociation transform in SimplifyCommutative (now renamed toDuncan Sands2010-11-131-0/+10
| | | | | | | | | | | | | | | | SimplifyAssociativeOrCommutative) "(A op C1) op C2" -> "A op (C1 op C2)", which previously was only done if C1 and C2 were constants, to occur whenever "C1 op C2" simplifies (a la InstructionSimplify). Since the simplifying operand combination can no longer be assumed to be the right-hand terms, consider all of the possible permutations. When compiling "gcc as one big file", transform 2 (i.e. using right-hand operands) fires about 4000 times but it has to be said that most of the time the simplifying operands are both constants. Transforms 3, 4 and 5 each fired once. Transform 6, which is an existing transform that I didn't change, never fired. With this change, the testcase is now optimized perfectly with one run of instcombine (previously it required instcombine + reassociate + instcombine, and it may just have been luck that this worked). llvm-svn: 119002
* Teach InstructionSimplify how to look through PHI nodes. Since PHIDuncan Sands2010-11-101-0/+47
| | | | | | | | | nodes can be used in loops, this could result in infinite looping if there is no recursion limit, so add such a limit. It is also used for the SelectInst case because in theory there could be an infinite loop there too if the basic block is unreachable. llvm-svn: 118694
* Add an additional test for icmp of select folding.Duncan Sands2010-11-081-0/+11
| | | | llvm-svn: 118441
* Add simplification of floating point comparisons with the resultDuncan Sands2010-11-071-0/+8
| | | | | | | of a select instruction, the same as already exists for integer comparisons. llvm-svn: 118379
* Fix a README item: when doing a comparison with the resultDuncan Sands2010-11-071-0/+10
| | | | | | | | of a select instruction, see if doing the compare with the true and false values of the select gives the same result. If so, that can be used as the value of the comparison. llvm-svn: 118378
* Teach instcombine to transformBenjamin Kramer2010-07-081-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | (X >s -1) ? C1 : C2 and (X <s 0) ? C2 : C1 into ((X >>s 31) & (C2 - C1)) + C1, avoiding the conditional. This optimization could be extended to take non-const C1 and C2 but we better stay conservative to avoid code size bloat for now. for int sel(int n) { return n >= 0 ? 60 : 100; } we now generate sarl $31, %edi andl $40, %edi leal 60(%rdi), %eax instead of testl %edi, %edi movl $60, %ecx movl $100, %eax cmovnsl %ecx, %eax llvm-svn: 107866
* add check lines for min/max tests.Chris Lattner2009-12-211-0/+16
| | | | llvm-svn: 91816
* really convert this to filecheck.Chris Lattner2009-12-211-5/+5
| | | | llvm-svn: 91815
* give instcombine some helper functions for matching MIN and MAX, andChris Lattner2009-12-211-0/+40
| | | | | | | | | implement some optimizations for MIN(MIN()) and MAX(MAX()) and MIN(MAX()) etc. This substantially improves the code in PR5822 but doesn't kick in much elsewhere. 2 max's were optimized in pairlocalalign and one in smg2000. llvm-svn: 91814
* filecheckizeChris Lattner2009-12-211-56/+175
| | | | llvm-svn: 91813
* The select instruction is not neccesarily in the same block as theChris Lattner2009-09-281-0/+16
| | | | | | | | phi nodes. Make sure to phi translate from the right block. This fixes a llvm-building-llvm failure on GVN-PRE.cpp llvm-svn: 82970
* Enhance the previous fix for PR4895 to allow more values than justChris Lattner2009-09-271-4/+27
| | | | | | | simple constants for the true/false value of the select. We now do phi translation etc. This really fixes PR4895 :) llvm-svn: 82917
* implement PR4895, by making FoldOpIntoPhi handle select conditionsChris Lattner2009-09-271-0/+22
| | | | | | | | | | that are phi nodes. Also tighten up FoldOpIntoPhi to treat constantexpr operands to phis just like other variables, avoiding moving constantexpr computations around. Patch by Daniel Dunbar. llvm-svn: 82913
* Use opt -S instead of piping bitcode output through llvm-dis.Dan Gohman2009-09-081-1/+1
| | | | llvm-svn: 81257
* Change these tests to feed the assembly files to opt directly, insteadDan Gohman2009-09-081-1/+1
| | | | | | of using llvm-as, now that opt supports this. llvm-svn: 81226
* Remove llvm-upgrade and update test cases.Tanya Lattner2008-03-011-123/+137
| | | | llvm-svn: 47793
* Implement PR1822Chris Lattner2007-11-251-3/+11
| | | | llvm-svn: 44318
* For PR1319:Reid Spencer2007-04-151-0/+1
| | | | | | | 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. llvm-svn: 36059
* For PR1319:Reid Spencer2007-04-141-2/+2
| | | | | | Upgrade tests to work with new llvm.exp version of llvm_runtest. llvm-svn: 36013
* Regression is gone, don't try to find it on clean target.Reid Spencer2007-01-171-0/+181
llvm-svn: 33296
OpenPOWER on IntegriCloud