summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
Commit message (Collapse)AuthorAgeFilesLines
* - 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
* Change class' public PassInfo variables to by initialized with theDan Gohman2008-05-137-7/+7
| | | | | | | | | | | address of the PassInfo directly instead of calling getPassInfo. This eliminates a bunch of dynamic initializations of static data. Also, fold RegisterPassBase into PassInfo, make a bunch of its data members const, and rearrange some code to initialize data members in constructors instead of using setter member functions. llvm-svn: 51022
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-138-31/+29
| | | | | | | several things that were neither in an anonymous namespace nor static but not intended to be global. llvm-svn: 51017
* Make several variable declarations static.Dan Gohman2008-05-061-1/+1
| | | | llvm-svn: 50696
* Remove uses of llvm/System/IncludeFile.h that are no longer needed.Dan Gohman2008-05-061-2/+0
| | | | llvm-svn: 50695
* Handle multiple return values.Devang Patel2008-05-031-1/+23
| | | | llvm-svn: 50604
* Fix PR2256, yet another miscompilation in simplifycfg of iChris Lattner2008-04-281-3/+4
| | | | | | | | multiple return values. Bill, please pull this into Tak. llvm-svn: 50332
* Feedback from chrisNate Begeman2008-04-251-2/+2
| | | | llvm-svn: 50271
* Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989Nick Lewycky2008-04-257-61/+11
| | | | | | r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123. llvm-svn: 50265
* Teach the PruningFunctionCloner how to look through loads with Nate Begeman2008-04-251-4/+12
| | | | | | ConstantExpression GEPs pointing into constant globals. llvm-svn: 50256
* Adjust inline cost computation to be less aggressive.Evan Cheng2008-04-241-2/+2
| | | | llvm-svn: 50222
* Split some code out of the main SimplifyCFG loop into its own function.Chris Lattner2008-04-241-65/+103
| | | | | | | Fix said code to handle merging return instructions together correctly when handling multiple return values. llvm-svn: 50199
* Check type instead of no. of operands.Devang Patel2008-04-231-1/+1
| | | | llvm-svn: 50179
* Move SplitBlockPredecessors out of loopsimplify into BasicBlockUtils.hChris Lattner2008-04-212-107/+115
| | | | | | | | | as a global helper function. At the same type, switch it from taking a vector of predecessors to an arbitrary sequential input. This allows us to switch LoopSimplify to use a SmallVector for various temporary vectors that it passed into SplitBlockPredecessors. llvm-svn: 50020
* Move domtree/frontier updating earlier, allowing us to use it to update phi Chris Lattner2008-04-211-31/+18
| | | | | | nodes, removing a hack. llvm-svn: 50019
* Factor dominator tree and frontier updating into SplitBlockPredecessorsChris Lattner2008-04-211-18/+14
| | | | | | instead of doing it after every call. llvm-svn: 50018
* simplify code, fit in 80 cols.Chris Lattner2008-04-211-65/+67
| | | | llvm-svn: 50015
* fit in 80 colsChris Lattner2008-04-211-6/+6
| | | | llvm-svn: 50014
* Remove unused variableScott Michel2008-04-171-1/+0
| | | | llvm-svn: 49838
* Workaround for PR2207, in which pred_iterator assert gets triggered due to aScott Michel2008-04-161-2/+9
| | | | | | wee problem in Xcode 2.[45]/gcc 4.0.1. llvm-svn: 49831
* VisualStudio project files updated. #include <algorithm> added to make ↵Chuck Rose III2008-04-151-0/+15
| | | | | | VisualStudio happy. Also had to undefine setjmp because of #include <csetjmp> turning setjmp into _setjmp in VisualStudio. llvm-svn: 49743
* Revert r49614. As Dan pointed out, some of these aren't correct.Owen Anderson2008-04-141-1/+1
| | | | llvm-svn: 49657
* Replace calls of the form V1->setName(V2->getName()) with V1->takeName(V2), Owen Anderson2008-04-131-1/+1
| | | | | | which is significantly more efficient. llvm-svn: 49614
* Fix insert point handling for multiple return values.Devang Patel2008-04-081-4/+12
| | | | llvm-svn: 49367
* The "stacksave is not nounwind problem" no longerDuncan Sands2008-04-071-8/+3
| | | | | | | | | needs to be fixed here - a previous commit made sure that intrinsics always get the right attributes. So remove no-longer needed code, and while there use Intrinsic::getDeclaration rather than getOrInsertFunction. llvm-svn: 49337
* Use Intrinsic::getDeclaration to get hold ofDuncan Sands2008-04-071-7/+8
| | | | | | | intrinsics. Fix up the argument type (should be i8*, was an array*). llvm-svn: 49336
OpenPOWER on IntegriCloud