summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Do not forget DebugLoc!Devang Patel2011-02-151-0/+1
| | | | llvm-svn: 125547
* Conservatively, clear optional flags, such as nsw, when performingDan Gohman2011-02-021-0/+15
| | | | | | | reassociation. No testcase, because I wasn't able to create a testcase which actually demonstrates a problem. llvm-svn: 124713
* fix PR9013, an infinite loop in instcombine.Chris Lattner2011-01-211-2/+10
| | | | llvm-svn: 123968
* update obsolete comment.Chris Lattner2011-01-211-4/+3
| | | | llvm-svn: 123965
* Don't try to pull vector bitcasts that change the number of elements throughNick Lewycky2011-01-211-3/+17
| | | | | | | 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
* remove a dead check, this was needed before we had an explicit veto on uses ↵Chris Lattner2011-01-161-5/+0
| | | | | | of phis. llvm-svn: 123569
* enhance FoldOpIntoPhi in instcombine to try harder when a phi hasChris Lattner2011-01-161-3/+19
| | | | | | | | multiple uses. In some cases, all the uses are the same operation, so instcombine can go ahead and promote the phi. In the testcase this pushes an add out of the loop. llvm-svn: 123568
* remove the AllowAggressive argument to FoldOpIntoPhi. It is forced to false ↵Chris Lattner2011-01-161-8/+3
| | | | | | | | in the first line of the function because it isn't a good idea, even for compares. llvm-svn: 123566
* more cleanups: use the IR builder.Chris Lattner2011-01-161-38/+39
| | | | llvm-svn: 123565
* tidy up code.Chris Lattner2011-01-161-16/+20
| | | | llvm-svn: 123564
* Add a generic expansion transform: A op (B op' C) -> (A op B) op' (A op C)Duncan Sands2010-12-221-54/+114
| | | | | | | | if both A op B and A op C simplify. This fires fairly often but doesn't make that much difference. On gcc-as-one-file it removes two "and"s and turns one branch into a select. llvm-svn: 122399
* Add some statistics, good for understanding how much more powerfulDuncan Sands2010-12-221-2/+12
| | | | | | instcombine is compared to instsimplify. llvm-svn: 122397
* fix an oversight caught by Frits!Chris Lattner2010-12-191-3/+4
| | | | llvm-svn: 122204
* move a transformation to a more logical place, simplifying it.Chris Lattner2010-12-191-0/+7
| | | | llvm-svn: 122183
* Transform (extractvalue (load P), ...) to (load (gep P, 0, ...)) if the load ↵Frits van Bommel2010-11-291-3/+30
| | | | | | has no other uses, shrinking the load. llvm-svn: 120323
* Rename SimplifyDistributed to the more meaningfull name SimplifyByFactorizing.Duncan Sands2010-11-231-5/+5
| | | | llvm-svn: 120051
* Propagate LeftDistributes and RightDistributes into their only uses.Duncan Sands2010-11-231-6/+4
| | | | | | Stylistic improvement suggested by Frits van Bommel. llvm-svn: 120026
* Fix typo pointed out by Frits van Bommel and Marius Wachtler.Duncan Sands2010-11-231-1/+1
| | | | llvm-svn: 120025
* Exploit distributive laws (eg: And distributes over Or, Mul over Add, etc) in aDuncan Sands2010-11-231-0/+111
| | | | | | | | | | | | fairly systematic way in instcombine. Some of these cases were already dealt with, in which case I removed the existing code. The case of Add has a bunch of funky logic which covers some of this plus a few variants (considers shifts to be a form of multiplication), which I didn't touch. The simplification performed is: A*B+A*C -> A*(B+C). The improvement is to do this in cases that were not already handled [such as A*B-A*C -> A*(B-C), which was reported on the mailing list], and also to do it more often by not checking for "only one use" if "B+C" simplifies. llvm-svn: 120024
* If a GEP index simply advances by multiples of a type of zero size,Duncan Sands2010-11-221-14/+24
| | | | | | then replace the index with zero. llvm-svn: 119974
* Move the "gep undef" -> "undef" transform from instcombine toDuncan Sands2010-11-221-3/+0
| | | | | | InstructionSimplify. llvm-svn: 119970
* Generalize the reassociation transform in SimplifyCommutative (now renamed toDuncan Sands2010-11-131-36/+118
| | | | | | | | | | | | | | | | 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
* SmallVectorize.Benjamin Kramer2010-10-231-3/+1
| | | | llvm-svn: 117213
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-1/+1
| | | | llvm-svn: 115996
* Add initialization routines to InstCombine.Owen Anderson2010-10-071-0/+9
| | | | llvm-svn: 115965
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-211-2/+2
| | | | llvm-svn: 109045
* cache result of operator*Gabor Greif2010-07-091-2/+3
| | | | llvm-svn: 107972
* use ArgOperand API, also tighten the type of visitFree to make this work out ↵Gabor Greif2010-06-241-6/+6
| | | | | | smoothly llvm-svn: 106736
* Teach instCombine to remove malloc+free if malloc's only uses are comparisonsDuncan Sands2010-05-271-17/+46
| | | | | | to null. Patch by Matti Niemenmaa. llvm-svn: 104871
* Revert 101465, it broke internal OpenGL testing.Eric Christopher2010-04-161-5/+5
| | | | | | | Probably the best way to know that all getOperand() calls have been handled is to replace that API instead of updating. llvm-svn: 101579
* reapply r101434Gabor Greif2010-04-161-5/+5
| | | | | | | | | | | | | with a fix for self-hosting rotate CallInst operands, i.e. move callee to the back of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary llvm-svn: 101465
* back out r101423 and r101397, they break llvm-gcc self-host on darwin10Gabor Greif2010-04-161-5/+5
| | | | llvm-svn: 101434
* reapply r101364, which has been backed out in r101368Gabor Greif2010-04-151-5/+5
| | | | | | | | | | | | | with a fix rotate CallInst operands, i.e. move callee to the back of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary llvm-svn: 101397
* back out r101364, as it trips the linux nightlybot on some clang C++ testsGabor Greif2010-04-151-5/+5
| | | | llvm-svn: 101368
* rotate CallInst operands, i.e. move callee to the backGabor Greif2010-04-151-5/+5
| | | | | | | | | | of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary llvm-svn: 101364
* There are two ways of checking for a given type, for example isa<PointerType>(T)Duncan Sands2010-02-161-4/+4
| | | | | | | and T->isPointerTy(). Convert most instances of the first form to the second form. Requested by Chris. llvm-svn: 96344
* Uniformize the names of type predicates: rather than having isFloatTy andDuncan Sands2010-02-151-4/+4
| | | | | | isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris! llvm-svn: 96223
* teach ComputeNumSignBits to look through PHI nodes.Chris Lattner2010-01-071-3/+0
| | | | llvm-svn: 92964
* Move remaining stuff to the isInteger predicate.Benjamin Kramer2010-01-051-2/+1
| | | | llvm-svn: 92771
* Convert a ton of simple integer type equality tests to the new predicate.Benjamin Kramer2010-01-051-1/+1
| | | | llvm-svn: 92760
* Use do+while instead of while for loops which obviously have aDan Gohman2010-01-051-4/+3
| | | | | | non-zero trip count. Use SmallVector's pop_back_val(). llvm-svn: 92734
* prune some #includes.Chris Lattner2010-01-051-8/+1
| | | | llvm-svn: 92712
* split and/or/xor out into one overly-large (2000LOC) file. However, I thinkChris Lattner2010-01-051-1963/+0
| | | | | | it does make sense to keep them together, at least for now. llvm-svn: 92711
* missed file with previous commit.Chris Lattner2010-01-051-418/+0
| | | | llvm-svn: 92710
* eliminate getBitCastOperand and simplify some over-complex inbounds stuff.Chris Lattner2010-01-051-46/+22
| | | | llvm-svn: 92708
* split call handling out to InstCombineCalls.cppChris Lattner2010-01-051-1110/+2
| | | | llvm-svn: 92707
* optimize cttz and ctlz when we can prove something about the Chris Lattner2010-01-051-1/+34
| | | | | | leading/trailing bits. Patch by Alastair Lynn! llvm-svn: 92706
* this inline function moved to addsubChris Lattner2010-01-051-24/+0
| | | | llvm-svn: 92705
* split add/sub out to its own file. Eliminate use ofChris Lattner2010-01-051-695/+0
| | | | | | | dyn_castNotVal in the X+~X transform. dyn_castNotVal is dramatic overkill for what the xform needed. llvm-svn: 92704
* all the places we use hasOneUse() we know are instructions, so inlineChris Lattner2010-01-051-12/+9
| | | | | | and simplify. llvm-svn: 92700
OpenPOWER on IntegriCloud