summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/Reassociate.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Suppress an unused variable warning when assertions are off;Duncan Sands2010-01-081-2/+3
| | | | | | remove some trailing whitespace while there. llvm-svn: 93008
* fix an infinite loop in reassociate building emacs.Chris Lattner2010-01-051-0/+4
| | | | llvm-svn: 92679
* Change errs() to dbgs().David Greene2010-01-051-15/+15
| | | | llvm-svn: 92617
* theoretically the negate we find could be in a different function, checkChris Lattner2010-01-021-0/+4
| | | | | | for this case. llvm-svn: 92425
* When factoring multiply expressions across adds, factor both Chris Lattner2010-01-011-21/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | positive and negative forms of constants together. This allows us to compile: int foo(int x, int y) { return (x-y) + (x-y) + (x-y); } into: _foo: ## @foo subl %esi, %edi leal (%rdi,%rdi,2), %eax ret instead of (where the 3 and -3 were not factored): _foo: imull $-3, 8(%esp), %ecx imull $3, 4(%esp), %eax addl %ecx, %eax ret this started out as: movl 12(%ebp), %ecx imull $3, 8(%ebp), %eax subl %ecx, %eax subl %ecx, %eax subl %ecx, %eax ret This comes from PR5359. llvm-svn: 92381
* clean up some comments.Chris Lattner2010-01-011-13/+13
| | | | llvm-svn: 92377
* switch from std::map to DenseMap for rank data structures.Chris Lattner2010-01-011-13/+13
| | | | llvm-svn: 92375
* reuse negates where possible instead of always creating them from scratch.Chris Lattner2009-12-311-1/+30
| | | | | | | | | | | | | | | | | | | | | This allows us to optimize test12 into: define i32 @test12(i32 %X) { %factor = mul i32 %X, -3 ; <i32> [#uses=1] %Z = add i32 %factor, 6 ; <i32> [#uses=1] ret i32 %Z } instead of: define i32 @test12(i32 %X) { %Y = sub i32 6, %X ; <i32> [#uses=1] %C = sub i32 %Y, %X ; <i32> [#uses=1] %Z = sub i32 %C, %X ; <i32> [#uses=1] ret i32 %Z } llvm-svn: 92373
* we don't need a smallptrset to detect duplicates, the values areChris Lattner2009-12-311-27/+27
| | | | | | sorted, so we can just do a linear scan. llvm-svn: 92372
* make reassociate more careful about not leaving around dead mul'sChris Lattner2009-12-311-1/+7
| | | | llvm-svn: 92370
* remove debugChris Lattner2009-12-311-1/+1
| | | | llvm-svn: 92369
* teach reassociate to factor x+x+x -> x*3. While I'm at it,Chris Lattner2009-12-311-22/+70
| | | | | | fix RemoveDeadBinaryOp to actually do something. llvm-svn: 92368
* change reassociate to use SmallVector for its key datastructuresChris Lattner2009-12-311-15/+18
| | | | | | instead of std::vector. llvm-svn: 92366
* change an if to an assert, fix comment.Chris Lattner2009-12-311-4/+4
| | | | llvm-svn: 92364
* move the rest of the add optimization code out to OptimizeAdd,Chris Lattner2009-12-311-93/+94
| | | | | | improve some comments, simplify a bit of code. llvm-svn: 92363
* factor statistic updating better.Chris Lattner2009-12-311-19/+9
| | | | llvm-svn: 92362
* simple fix for an incorrect factoring which causes aChris Lattner2009-12-311-0/+7
| | | | | | miscompilation, PR5458. llvm-svn: 92354
* factor code out into helper functions.Chris Lattner2009-12-311-88/+109
| | | | llvm-svn: 92347
* switch some std::vector's to smallvector. Reduce nesting.Chris Lattner2009-12-311-54/+57
| | | | llvm-svn: 92346
* use more modern datastructures.Chris Lattner2009-12-311-4/+5
| | | | llvm-svn: 92344
* clean up -debug output.Chris Lattner2009-12-311-3/+4
| | | | llvm-svn: 92343
* Remove LLVMContext from reassociate. It was threaded through every function butNick Lewycky2009-11-141-22/+14
| | | | | | ultimately never used. llvm-svn: 88763
* Make changes to rev 84292 as requested by Chris Lattner.Victor Hernandez2009-10-211-2/+0
| | | | | | | Most changes are cleanup, but there is 1 correctness fix: I fixed InstCombine so that the icmp is removed only if the malloc call is removed (which requires explicit removal because the Worklist won't DCE any calls since they can have side-effects). llvm-svn: 84772
* Remove MallocInst from LLVM Instructions.Victor Hernandez2009-10-171-1/+1
| | | | llvm-svn: 84299
* Autoupgrade malloc insts to malloc calls.Victor Hernandez2009-10-171-1/+2
| | | | | | | | Update testcases that rely on malloc insts being present. Also prematurely remove MallocInst handling from IndMemRemoval and RaiseAllocations to help pass tests in this incremental step. llvm-svn: 84292
* calls are already unmovable, malloc doesn't need a special case.Chris Lattner2009-09-271-2/+1
| | | | llvm-svn: 82933
* Enhance transform passes so that they apply the same tranforms to malloc ↵Victor Hernandez2009-09-181-1/+2
| | | | | | | | calls as to MallocInst. Reviewed by Dan Gohman. llvm-svn: 82300
* eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861Chris Lattner2009-09-021-3/+2
| | | | llvm-svn: 80766
* remove the std::ostream version of module and type printing.Chris Lattner2009-08-231-3/+3
| | | | llvm-svn: 79823
* eliminate the "Value" printing methods that print to a std::ostream.Chris Lattner2009-08-231-13/+14
| | | | | | This required converting a bunch of stuff off DOUT and other cleanups. llvm-svn: 79819
* Fix debug output to include a newline after printing a Value, nowDan Gohman2009-08-171-7/+7
| | | | | | that Value's operator<< doesn't include one. llvm-svn: 79240
* Remove a bunch more now-unnecessary Context arguments.Dan Gohman2009-08-121-1/+1
| | | | llvm-svn: 78809
* Move a few more APIs back to 2.5 forms. The only remaining ones left to ↵Owen Anderson2009-07-311-7/+5
| | | | | | | | change back are metadata related, which I'm waiting on to avoid conflicting with Devang. llvm-svn: 77721
* Move more code back to 2.5 APIs.Owen Anderson2009-07-301-3/+3
| | | | llvm-svn: 77635
* Move ConstantExpr to 2.5 API.Owen Anderson2009-07-291-2/+2
| | | | llvm-svn: 77494
* Revert the ConstantInt constructors back to their 2.5 forms where possible, ↵Owen Anderson2009-07-241-1/+1
| | | | | | thanks to contexts-on-types. More to come. llvm-svn: 77011
* Get rid of the Pass+Context magic.Owen Anderson2009-07-221-17/+22
| | | | llvm-svn: 76702
* These don't really need contexts either.Owen Anderson2009-07-131-6/+6
| | | | llvm-svn: 75528
* Move more functionality over to LLVMContext.Owen Anderson2009-07-131-2/+2
| | | | llvm-svn: 75497
* Begin the painful process of tearing apart the rat'ss nest that is ↵Owen Anderson2009-07-131-15/+15
| | | | | | | | | Constants.cpp and ConstantFold.cpp. This involves temporarily hard wiring some parts to use the global context. This isn't ideal, but it's the only way I could figure out to make this process vaguely incremental. llvm-svn: 75445
* "LLVMContext* " --> "LLVMContext *"Owen Anderson2009-07-061-2/+2
| | | | llvm-svn: 74878
* Even more passes being LLVMContext'd.Owen Anderson2009-07-031-17/+23
| | | | llvm-svn: 74781
* Make the key of ValueRankMap an AssertingVH, so that we die violentlyChris Lattner2009-03-311-6/+7
| | | | | | if it dangles. llvm-svn: 68150
* This pass keeps a map of Instructions to Rank numbers,Dale Johannesen2009-03-191-8/+14
| | | | | | | | | and was deleting Instructions without clearing the corresponding map entry. This led to nondeterministic behavior if the same address got allocated to another Instruction within a short time. llvm-svn: 67306
* Don't assign rank numbers to debug intrinsic "calls".Dale Johannesen2009-03-061-1/+3
| | | | | | This is needed so debug info doesn't change codegen. llvm-svn: 66235
* Fix build failure.Devang Patel2008-11-211-1/+1
| | | | llvm-svn: 59844
* Silence unused variable warnings.Devang Patel2008-11-211-0/+3
| | | | llvm-svn: 59841
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-041-1/+1
| | | | llvm-svn: 55779
* don't use the result of WriteAsOperandChris Lattner2008-08-191-4/+5
| | | | llvm-svn: 54979
* API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. ↵Gabor Greif2008-05-161-7/+7
| | | | | | Legacy interfaces will be in place for some time. (Merge from use-diet branch.) llvm-svn: 51200
OpenPOWER on IntegriCloud