summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
Commit message (Collapse)AuthorAgeFilesLines
* Handle "always inline" note during inline cost analysis.Devang Patel2008-09-031-0/+3
| | | | llvm-svn: 55712
* Switch the asmprinter (.ll) and all the stuff it requires over toChris Lattner2008-08-231-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | use raw_ostream instead of std::ostream. Among other goodness, this speeds up llvm-dis of kc++ with a release build from 0.85s to 0.49s (88% faster). Other interesting changes: 1) This makes Value::print be non-virtual. 2) AP[S]Int and ConstantRange can no longer print to ostream directly, use raw_ostream instead. 3) This fixes a bug in raw_os_ostream where it didn't flush itself when destroyed. 4) This adds a new SDNode::print method, instead of only allowing "dump". A lot of APIs have both std::ostream and raw_ostream versions, it would be useful to go through and systematically anihilate the std::ostream versions. This passes dejagnu, but there may be minor fallout, plz let me know if so and I'll fix it. llvm-svn: 55263
* Add a new trivial -inst-namer pass which makes it possible to diff theChris Lattner2008-08-231-0/+49
| | | | | | before/after effects of a pass, crazy! llvm-svn: 55230
* Rename some GC classes so that their roll will hopefully be clearer.Gordon Henriksen2008-08-171-4/+4
| | | | | | | | | | | | | | | | | | In particular, Collector was confusing to implementors. Several thought that this compile-time class was the place to implement their runtime GC heap. Of course, it doesn't even exist at runtime. Specifically, the renames are: Collector -> GCStrategy CollectorMetadata -> GCFunctionInfo CollectorModuleMetadata -> GCModuleInfo CollectorRegistry -> GCRegistry Function::getCollector -> getGC (setGC, hasGC, clearGC) Several accessors and nested types have also been renamed to be consistent. These changes should be obvious. llvm-svn: 54899
* Rework the routines that convert AP[S]Int into a string. Now, instead ofChris Lattner2008-08-171-5/+3
| | | | | | | | | | | | | | | | | returning an std::string by value, it fills in a SmallString/SmallVector passed in. This significantly reduces string thrashing in some cases. More specifically, this: - Adds an operator<< and a print method for APInt that allows you to directly send them to an ostream. - Reimplements APInt::toString to be much simpler and more efficient algorithmically in addition to not thrashing strings quite as much. This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the asmprinter. This also fixes a bug I introduced into the asmwriter in a previous patch w.r.t. alias printing. llvm-svn: 54873
* Use empty() instead of begin() == end().Dan Gohman2008-08-141-1/+1
| | | | llvm-svn: 54780
* Enable first-class aggregates support.Dan Gohman2008-07-234-152/+55
| | | | | | | | | | | | Remove the GetResultInst instruction. It is still accepted in LLVM assembly and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove support for return instructions with multiple values. These are auto-upgraded to use InsertValueInst instructions. The IRBuilder still accepts multiple-value returns, and auto-upgrades them to InsertValueInst instructions. llvm-svn: 53941
* Reapply r53735. My last patch fixed the failures Dan observed.Owen Anderson2008-07-181-52/+9
| | | | llvm-svn: 53761
* Add some checks that got lost in the shuffle. This fixes 464.h264ref.Owen Anderson2008-07-181-0/+4
| | | | llvm-svn: 53760
* Revert r53735. It broke SPEC 464.h264ref.Dan Gohman2008-07-181-9/+52
| | | | llvm-svn: 53757
* Use MergeBlockIntoPredecessor to simplify some code.Owen Anderson2008-07-171-52/+9
| | | | llvm-svn: 53735
* Make MergeBlockIntoPredecessor more aggressive when the same successor appearsOwen Anderson2008-07-171-5/+24
| | | | | | more than once. llvm-svn: 53731
* Inliner tweak. Function calls should cost more than one instruction!Evan Cheng2008-07-171-0/+5
| | | | llvm-svn: 53712
* Factor MergeBlockIntoPredecessor out into BasicBlockUtils.Owen Anderson2008-07-171-0/+52
| | | | llvm-svn: 53705
* Reapply r53540, now with the matching header!Chris Lattner2008-07-141-1/+23
| | | | llvm-svn: 53557
* Revert r53540 - it does not compile.Duncan Sands2008-07-141-23/+1
| | | | llvm-svn: 53549
* If a function calls setjmp, never inline it into other functions. This isChris Lattner2008-07-141-1/+23
| | | | | | | a hack around the fact that we don't represent the CFG correctly for sj/lj. It fixes PR2486. llvm-svn: 53540
* simplify some code, shuffle and insertelt always return a vector.Chris Lattner2008-07-141-2/+1
| | | | llvm-svn: 53538
* Fix mishandling of the infinite loop case when merging two blocks. ThisChris Lattner2008-07-131-17/+26
| | | | | | fixes PR2540. llvm-svn: 53533
* more refactoring. Use early exits instead of really complex logic.Chris Lattner2008-07-131-109/+98
| | | | | | No functionality change. llvm-svn: 53532
* improve comments.Chris Lattner2008-07-131-2/+4
| | | | llvm-svn: 53531
* factor another large hunk of code out into its own function. Chris Lattner2008-07-131-155/+172
| | | | | | No functionality change. llvm-svn: 53530
* Final bit of simplification for FoldBranchToCommonDest.Chris Lattner2008-07-131-32/+34
| | | | llvm-svn: 53528
* simplify logic a bitChris Lattner2008-07-131-9/+10
| | | | llvm-svn: 53527
* Refactor some code out into its own helper function, getting rid of crazy ↵Chris Lattner2008-07-131-54/+84
| | | | | | | | | | multiline conditionals and commenting the code better. No functionality change. llvm-svn: 53526
* - Use O(1) check of basic block size limit.Evan Cheng2008-06-251-4/+8
| | | | | | - Avoid speculatively execute vector ops. llvm-svn: 52703
* Revert 52645, the loop unroller changes. It caused a regression in 252.eon.Dan Gohman2008-06-241-120/+103
| | | | llvm-svn: 52688
* Revamp the loop unroller, extending it to correctly update PHI nodesDan Gohman2008-06-231-103/+120
| | | | | | | | in the presence of out-of-loop users of in-loop values and the trip count is not a known multiple of the unroll count, and to be a bit simpler overall. This fixes PR2253. llvm-svn: 52645
* Use Loop::block_iterator.Dan Gohman2008-06-221-2/+3
| | | | llvm-svn: 52616
* Use Instruction::eraseFromParent().Dan Gohman2008-06-213-7/+7
| | | | llvm-svn: 52606
* Fix warning when assertions disabled.Chris Lattner2008-06-211-1/+1
| | | | llvm-svn: 52590
* Clean up a use of std::distance.Dan Gohman2008-06-201-2/+1
| | | | llvm-svn: 52544
* Teach InlineFunction how to differentiate between multiple-valueDan Gohman2008-06-201-2/+10
| | | | | | | return statements and aggregate returns so that it handles both correctly. llvm-svn: 52519
* Delete dead code.Dan Gohman2008-06-191-4/+0
| | | | llvm-svn: 52494
* Do not speculatively execute an instruction by hoisting it to its ↵Evan Cheng2008-06-121-2/+16
| | | | | | predecessor BB if any of its operands are defined but not used in BB. The transformation will prevent the operand from being sunk into the use block. llvm-svn: 52244
* For now, avoid generating FP select instructions in order to speculatively ↵Evan Cheng2008-06-111-4/+9
| | | | | | | | execute integer arithmetic instructions. FP selects are more likely to be expensive (even compared to branch on fcmp). This is not a wonderful solution but I rather err on the side of conservative. This fixes the heapsort performance regressions. llvm-svn: 52224
* op_iterator-ify loopsGabor Greif2008-06-101-13/+16
| | | | llvm-svn: 52191
* Speculatively execute a block when the the block is the then part of a ↵Evan Cheng2008-06-071-0/+121
| | | | | | | | | | | | | | | | | | | | triangle shape and it contains a single, side effect free, cheap instruction. The branch is eliminated by adding a select instruction. i.e. Turn BB: %t1 = icmp br i1 %t1, label %BB1, label %BB2 BB1: %t3 = add %t2, c br label BB2 BB2: => BB: %t1 = icmp %t4 = add %t2, c %t3 = select i1 %t1, %t2, %t3 llvm-svn: 52073
* LoopSimplify preserves AA.Devang Patel2008-06-061-3/+5
| | | | llvm-svn: 52053
* LoopIndexSplit can sometimes result in cases where a block in its own ↵Owen Anderson2008-06-031-3/+6
| | | | | | | | domfrontier. Don't crash when we encounter one of these. llvm-svn: 51915
* Fix whitespace in whitespace-significant pseudocode in a comment.Dan Gohman2008-06-031-2/+2
| | | | llvm-svn: 51890
* rewrite operand loops to use iteratorsGabor Greif2008-05-301-24/+26
| | | | llvm-svn: 51789
* Since LCSSA switched over to DenseMap, we have to be more careful to avoid ↵Owen Anderson2008-05-301-4/+5
| | | | | | iterator invalidation. Fixes PR2385. llvm-svn: 51777
* Factor code to copy global value attributes likeDuncan Sands2008-05-262-11/+5
| | | | | | | | | | | | | | | the section or the visibility from one global value to another: copyAttributesFrom. This is particularly useful for duplicating functions: previously this was done by explicitly copying each attribute in turn at each place where a new function was created out of an old one, with the result that obscure attributes were regularly forgotten (like the collector or the section). Hopefully now everything is uniform and nothing is forgotten. llvm-svn: 51567
* Use a DenseMap instead of an std::map, speeding up the testcase in PR2368 by ↵Owen Anderson2008-05-261-3/+3
| | | | | | about a third. llvm-svn: 51565
* Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places toDan Gohman2008-05-234-9/+4
| | | | | | use it instead of duplicating its functionality. llvm-svn: 51499
* Restucture a part of the SimplifyCFG pass and include a testcase.Matthijs Kooijman2008-05-231-65/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SimplifyCFG pass looks at basic blocks that contain only phi nodes, followed by an unconditional branch. In a lot of cases, such a block (BB) can be merged into their successor (Succ). This merging is performed by TryToSimplifyUncondBranchFromEmptyBlock. It does this by taking all phi nodes in the succesor block Succ and expanding them to include the predecessors of BB. Furthermore, any phi nodes in BB are moved to Succ and expanded to include the predecessors of Succ as well. Before attempting this merge, CanPropagatePredecessorsForPHIs checks to see if all phi nodes can be properly merged. All functional changes are made to this function, only comments were updated in TryToSimplifyUncondBranchFromEmptyBlock. In the original code, CanPropagatePredecessorsForPHIs looks quite convoluted and more like stack of checks added to handle different kinds of situations than a comprehensive check. In particular the first check in the function did some value checking for the case that BB and Succ have a common predecessor, while the last check in the function simply rejected all cases where BB and Succ have a common predecessor. The first check was still useful in the case that BB did not contain any phi nodes at all, though, so it was not completely useless. Now, CanPropagatePredecessorsForPHIs is restructured to to look a lot more similar to the code that actually performs the merge. Both functions now look at the same phi nodes in about the same order. Any conflicts (phi nodes with different values for the same source) that could arise from merging or moving phi nodes are detected. If no conflicts are found, the merge can happen. Apart from only restructuring the checks, two main changes in functionality happened. Firstly, the old code rejected blocks with common predecessors in most cases. The new code performs some extra checks so common predecessors can be handled in a lot of cases. Wherever common predecessors still pose problems, the blocks are left untouched. Secondly, the old code rejected the merge when values (phi nodes) from BB were used in any other place than Succ. However, it does not seem that there is any situation that would require this check. Even more, this can be proven. Consider that BB is a block containing of a single phi node "%a" and a branch to Succ. Now, since the definition of %a will dominate all of its uses, BB will dominate all blocks that use %a. Furthermore, since the branch from BB to Succ is unconditional, Succ will also dominate all uses of %a. Now, assume that one predecessor of Succ is not dominated by BB (and thus not dominated by Succ). Since at least one use of %a (but in reality all of them) is reachable from Succ, you could end up at a use of %a without passing through it's definition in BB (by coming from X through Succ). This is a contradiction, meaning that our original assumption is wrong. Thus, all predecessors of Succ must also be dominated by BB (and thus also by Succ). This means that moving the phi node %a from BB to Succ does not pose any problems when the two blocks are merged, and any use checks are not needed. llvm-svn: 51478
* API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. ↵Gabor Greif2008-05-163-8/+8
| | | | | | Legacy interfaces will be in place for some time. (Merge from use-diet branch.) llvm-svn: 51200
* Fix a bunch of 80col violations that arose from the Create API change. Tweak ↵Gabor Greif2008-05-154-6/+10
| | | | | | makefile targets to find these better. llvm-svn: 51143
* Split the loop unroll mechanism logic out into a utility function.Dan Gohman2008-05-141-0/+371
| | | | | | Patch by Matthijs Kooijman! llvm-svn: 51083
OpenPOWER on IntegriCloud