summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* revert r83814 for now, it is making the llvm-gcc bootstrap unhappy.Chris Lattner2009-10-111-26/+1
| | | | llvm-svn: 83817
* populate instcombine's initial worklist more carefully, causingChris Lattner2009-10-111-1/+26
| | | | | | | | it to visit instructions from the start of the function to the end of the function in the first path. This greatly speeds up some pathological cases (e.g. PR5150). llvm-svn: 83814
* remove some harmful code that would turn an insertelement on an undefChris Lattner2009-10-111-22/+0
| | | | | | | | | | | into a shuffle even if it was used by another insertelement. If the visitation order of instcombine was wrong, this would turn a chain of insertelements into a chain of shufflevectors, which was quite painful. Since CollectShuffleElements handles these cases, the code can just be nuked. llvm-svn: 83810
* teach instcombine to simplify xor's harder, catching theChris Lattner2009-10-111-0/+27
| | | | | | new testcase. llvm-svn: 83799
* cleanupsChris Lattner2009-10-111-20/+18
| | | | llvm-svn: 83797
* cleanup, no functionality change.Chris Lattner2009-10-111-34/+33
| | | | llvm-svn: 83795
* generalize a transformation even more: we don't care whether theChris Lattner2009-10-111-12/+10
| | | | | | | | | input the the mul is a zext from bool, just that it is all zeros other than the low bit. This fixes some phase ordering issues that would cause us to miss some xforms in mul.ll when the worklist is visited differently. llvm-svn: 83794
* simplify a transformation by making it more general.Chris Lattner2009-10-111-32/+14
| | | | llvm-svn: 83792
* temporarily revert previous patchChris Lattner2009-10-111-14/+1
| | | | llvm-svn: 83791
* populate instcombine's initial worklist more carefully, causingChris Lattner2009-10-111-1/+14
| | | | | | | | it to visit instructions from the start of the function to the end of the function in the first path. This greatly speeds up some pathological cases (e.g. PR5150). llvm-svn: 83790
* implement rdar://7293527, a trivial instcombine that llvm-gccChris Lattner2009-10-111-1/+12
| | | | | | | gets but clang doesn't, because it is implemented in GCC's fold routine. llvm-svn: 83761
* In instcombine's debug output, avoid printing ADD for instructions that areJeffrey Yasskin2009-10-081-3/+5
| | | | | | | already on the worklist, and print Visited when an instruction is about to be visited. Net, on one input, this reduced the output size by at least 9x. llvm-svn: 83510
* Introduce and use convenience methods for getting pointer typesDuncan Sands2009-10-061-3/+3
| | | | | | | where the element is of a basic builtin type. For example, to get an i8* use getInt8PtrTy. llvm-svn: 83379
* Remove an unnnecessary LLVMContext argument inDan Gohman2009-10-051-2/+1
| | | | | | ConstantFoldLoadThroughGEPConstantExpr. llvm-svn: 83311
* Use Use::operator= instead of Use::set, for consistency.Dan Gohman2009-10-051-2/+2
| | | | llvm-svn: 83310
* instcombine shouldn't delete all null checks for mallocs.Chris Lattner2009-10-051-2/+2
| | | | | | This fixes PR5130. llvm-svn: 83290
* The select instruction is not neccesarily in the same block as theChris Lattner2009-09-281-2/+3
| | | | | | | | 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
* The bitcast case is not needed here: instcombine turns icmp(bitcast(x), ↵Chris Lattner2009-09-271-24/+7
| | | | | | null) -> icmp(x, null) already. llvm-svn: 82935
* allow pushing icmps through phis with multiple uses and across critical edges.Chris Lattner2009-09-271-8/+23
| | | | | | These are important to push up to encourage jump threading. This shrinks 176.gcc a bit. llvm-svn: 82923
* Enhance the previous fix for PR4895 to allow more values than justChris Lattner2009-09-271-13/+26
| | | | | | | 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-11/+42
| | | | | | | | | | 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
* Enhance transform passes so that they apply the same tranforms to malloc ↵Victor Hernandez2009-09-181-8/+54
| | | | | | | | calls as to MallocInst. Reviewed by Dan Gohman. llvm-svn: 82300
* Change FoldPHIArgBinOpIntoPHI to decline folding if it would introduce twoDan Gohman2009-09-161-7/+13
| | | | | | | | phis, similar to the FoldPHIArgGEPIntoPHI change. Also, delete some comments that don't reflect the code. llvm-svn: 82053
* Don't sink gep operators through phi nodes if the result would requireDan Gohman2009-09-161-1/+14
| | | | | | | | more than one phi, since that leads to higher register pressure on entry to the phi. This is especially problematic when the phi is in a loop header, as it increases register pressure throughout the loop. llvm-svn: 81993
* remove an extremely dubious instcombine transformation ofChris Lattner2009-09-081-42/+14
| | | | | | extractelement(load). llvm-svn: 81239
* remove a turdChris Lattner2009-09-081-1/+0
| | | | llvm-svn: 81186
* instcombine transforms vector loads that are only used byChris Lattner2009-09-081-22/+27
| | | | | | | | | | | | | | | | | | extractelement operations into a bitcast of the pointer, then a gep, then a scalar load. Disable this when the vector only has one element, because it leads to infinite loops in instcombine (PR4908). This transformation seems like a really bad idea to me, as it will likely disable CSE of vector load/stores etc and can be better done in the code generator when profitable. This goes all the way back to the first days of packed types, r25299 specifically. I'll let those people who care about the performance of vector code decide what to do with this. llvm-svn: 81185
* Reappy r80998, now that the GlobalOpt bug that it exposed on MiniSAT is fixed.Dan Gohman2009-09-071-41/+32
| | | | llvm-svn: 81172
* Fix a possible crash call setIsInBounds.Daniel Dunbar2009-09-061-2/+2
| | | | | | | | - I think there are more instances of this, but I think they are fixed in Dan's incoming patch. This one was preventing me from doing a bugpoint reduction though. llvm-svn: 81103
* Revert "Include optional subclass flags, such as inbounds, nsw, etc., ...", thisDaniel Dunbar2009-09-061-33/+43
| | | | | | breaks MiniSAT on x86_64. llvm-svn: 81098
* Include optional subclass flags, such as inbounds, nsw, etc., in theDan Gohman2009-09-041-43/+33
| | | | | | | | | | | | | | | | | Constant uniquing tables. This allows distinct ConstantExpr objects with the same operation and different flags. Even though a ConstantExpr "a + b" is either always overflowing or never overflowing (due to being a ConstantExpr), it's still necessary to be able to represent it both with and without overflow flags at the same time within the IR, because the safety of the flag may depend on the context of the use. If the constant really does overflow, it wouldn't ever be safe to use with the flag set, however the use may be in code that is never actually executed. This also makes it possible to merge all the flags tests into a single test. llvm-svn: 80998
* eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861Chris Lattner2009-09-021-4/+2
| | | | llvm-svn: 80766
* fix PR4837, some bugs folding vector compares. TheseChris Lattner2009-09-021-7/+7
| | | | | | return a vector of i1, not i1 itself. llvm-svn: 80761
* fix some cases where instcombine would change hte IR but not return trueChris Lattner2009-08-311-8/+10
| | | | | | from runOnFunction llvm-svn: 80562
* improve -debug output, so that -debug is more likely to print whenChris Lattner2009-08-311-3/+6
| | | | | | instcombine is changing stuff. llvm-svn: 80538
* fix a bug I introduced with my 'instcombine builder' refactoring Chris Lattner2009-08-311-2/+6
| | | | | | | | changes: SimplifyDemandedBits can't use the builder yet because it has the wrong insertion point. This fixes a crash building MultiSource/Benchmarks/PAQ8p llvm-svn: 80537
* Fix PR4748: don't fold gep(bitcast(x)) into bitcast(gep) when x Chris Lattner2009-08-301-0/+7
| | | | | | | | | is itself a bitcast. Since we have gep(bitcast(bitcast(y))) in this case, just wait for the two bitcasts to get zapped. This prevents instcombine from confusing some aliasing stuff, and allows it to directly eliminate the load in the testcase. llvm-svn: 80508
* misc cleanupChris Lattner2009-08-301-13/+13
| | | | llvm-svn: 80507
* add getPointerAddressSpace() to GEP instruction, use the methodChris Lattner2009-08-301-6/+4
| | | | | | in a few scalar xforms to simplify things. llvm-svn: 80506
* eliminate InsertCastBefore, use the builder instead.Chris Lattner2009-08-301-50/+19
| | | | llvm-svn: 80505
* eliminate InsertBitCastBefore, just use the builder instead.Chris Lattner2009-08-301-27/+24
| | | | llvm-svn: 80504
* convert a bunch more calls to InsertNewInstBefore to useChris Lattner2009-08-301-205/+137
| | | | | | the new Instcombine builder. llvm-svn: 80501
* fix typoChris Lattner2009-08-301-1/+1
| | | | llvm-svn: 80500
* give instcombine a custom IRBuilder that adds new instructions to theChris Lattner2009-08-301-304/+193
| | | | | | | | | | workslist and is set to insert new instructions before the current one. Convert a bunch of stuff that used to call InsertNewInstBefore over to use it, greatly simplifying code and making it more natural. There is still a lot more to go, but this is a good start. llvm-svn: 80492
* add a new InstCombineWorklist::AddValue method that works evenChris Lattner2009-08-301-16/+13
| | | | | | | | | if the operand is not an instruction. Simplify most uses of AddOperandsToWorkList to use AddValue and inline it into the one remaining callsite. llvm-svn: 80488
* move AddUsersToWorkList to the worklist processing class, make theChris Lattner2009-08-301-16/+16
| | | | | | argument stronger typed. llvm-svn: 80487
* rename AddUsesToWorkList -> AddOperandsToWorkList. The Chris Lattner2009-08-301-31/+13
| | | | | | | | | | former looks too much like AddUsersToWorkList and keeps confusing me. Remove AddSoonDeadInstToWorklist and change its two callers to do the same thing in a simpler way. llvm-svn: 80486
* inline the trivial AddToWorkList/RemoveFromWorkList methodsChris Lattner2009-08-301-104/+65
| | | | | | | | | | | | | into their callers. simplify ReplaceInstUsesWith. Make EraseInstFromFunction only add operands to the worklist if there aren't too many of them (this was a scalability win for crazy programs that was only infrequently enforced). Switch more code to using EraseInstFromFunction instead of duplicating it inline. Change some fcmp/icmp optimizations to modify fcmp/icmp in place instead of creating a new one and deleting the old one just to change the predicate. llvm-svn: 80483
* fix a bug I introduced in r80478 found by the build bot.Chris Lattner2009-08-301-1/+2
| | | | llvm-svn: 80482
* refactor instcombine's worklist processing stuff out to its own class.Chris Lattner2009-08-301-26/+58
| | | | llvm-svn: 80481
OpenPOWER on IntegriCloud