summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar
Commit message (Collapse)AuthorAge
* Fix uninitialized use of the Changed variable.Dan Gohman2008-07-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53564 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR2506 by being a bit more careful about reverse fact propagation whenChris Lattner2008-07-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | disproving a condition. This actually compiles the existing testcase (udiv_select_to_select_shift) to: define i64 @test(i64 %X, i1 %Cond) { entry: %divisor1.t = lshr i64 %X, 3 ; <i64> [#uses=1] %quotient2 = lshr i64 %X, 3 ; <i64> [#uses=1] %sum = add i64 %divisor1.t, %quotient2 ; <i64> [#uses=1] ret i64 %sum } instead of: define i64 @test(i64 %X, i1 %Cond) { entry: %quotient1.v = select i1 %Cond, i64 3, i64 4 ; <i64> [#uses=1] %quotient1 = lshr i64 %X, %quotient1.v ; <i64> [#uses=1] %quotient2 = lshr i64 %X, 3 ; <i64> [#uses=1] %sum = add i64 %quotient1, %quotient2 ; <i64> [#uses=1] ret i64 %sum } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53534 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance analysis of srem.Nick Lewycky2008-07-12
| | | | | | | | Remove dead code analyzing urem. 'urem' of power-of-2 is canonicalized to an 'and' instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53506 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't call lookupNumber more than we have to.Owen Anderson2008-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53470 91177308-0d34-0410-b5e6-96231b3b80d8
* Document 'mask' in this calculation.Nick Lewycky2008-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53454 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove misleading constant from comment.Nick Lewycky2008-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53452 91177308-0d34-0410-b5e6-96231b3b80d8
* Add another optimization from PR2330. Also catch some missing cases that areNick Lewycky2008-07-11
| | | | | | | similar. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53451 91177308-0d34-0410-b5e6-96231b3b80d8
* a missed optimization that Eli spottedChris Lattner2008-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53449 91177308-0d34-0410-b5e6-96231b3b80d8
* another bug in the same line.Chris Lattner2008-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53448 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a bug spotted by Eli's eagle eyesChris Lattner2008-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53447 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify and merge a bunch of code. Instead of comparing againstChris Lattner2008-07-11
| | | | | | | | | the min/max values for an integer type, compare against the min/max values we can prove contain the input. This might be a tighter bound, so this is general goodness. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53446 91177308-0d34-0410-b5e6-96231b3b80d8
* fold away (x <= cst) earlier, allowing us to not have to Chris Lattner2008-07-11
| | | | | | | handle them in some code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53445 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix folding of icmp's of i1 where the comparison is signed. The codeChris Lattner2008-07-11
| | | | | | | | was using the algorithm for folding unsigned comparisons which is completely wrong. This has been broken since the signless types change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53444 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bogus optimization: folding (slt (zext i1 A to i32), 1) -> (slt i1 A, ↵Chris Lattner2008-07-11
| | | | | | | | | | | | | | true) This cause a regression in InstCombine/JavaCompare, which was doing the right thing on accident. To handle the missed case, generalize the comparisons based on masked bits a little bit to handle comparisons against the max value. For example, we can now xform (slt i32 (and X, 4), 4) -> (setne i32 (and X, 4), 4) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53443 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix overzealous optimization. Thanks to Duncan Sands for pointing out my error!Nick Lewycky2008-07-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53393 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify, suggested by Chris Lattner.Nick Lewycky2008-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53283 91177308-0d34-0410-b5e6-96231b3b80d8
* Fold (a < 8) && (b < 8) into (a|b) < 8 for unsigned less or greater than.Nick Lewycky2008-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53282 91177308-0d34-0410-b5e6-96231b3b80d8
* Fold ((1 << a) & 1) to (a == 0).Nick Lewycky2008-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53276 91177308-0d34-0410-b5e6-96231b3b80d8
* Reduce x - y to -y when we know the 'x' part will get masked off anyways.Nick Lewycky2008-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53271 91177308-0d34-0410-b5e6-96231b3b80d8
* If loop induction variable's start value is less then its exit value then do ↵Devang Patel2008-07-09
| | | | | | not split the loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53265 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR2496, a really nasty bug which involved sinking volatile loads Chris Lattner2008-07-08
| | | | | | | | | | | into phis. This is actually the same bug as PR2262 / 2008-04-29-VolatileLoadDontMerge.ll, but I missed checking the first predecessor for multiple successors. Testcase here: InstCombine/2008-07-08-VolatileLoadMerge.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53240 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix two serious LSR bugs.Evan Cheng2008-07-07
| | | | | | | | 1. LSR runOnLoop is always returning false regardless if any transformation is made. 2. AddUsersIfInteresting can create new instructions that are added to DeadInsts. But there is a later early exit which prevents them from being freed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53193 91177308-0d34-0410-b5e6-96231b3b80d8
* Make DenseMap's insert return a pair, to more closely resemble std::map.Dan Gohman2008-07-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53177 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix missed optimization opportunity when analyzing cast of mul and select.Nick Lewycky2008-07-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53151 91177308-0d34-0410-b5e6-96231b3b80d8
* Use information already present in the ValueTable to fast-fail when we know ↵Owen Anderson2008-07-03
| | | | | | there won't be a value number match. This speeds up GVN on a case where there are very few redundancies by ~25%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53108 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not try to update dominator info while manipulating CFG. This code does ↵Devang Patel2008-07-03
| | | | | | | | | not handle all cases and keeps invalid dom info around some cases, which misleads other passes down stream. Right now, dom info is recaluclated in the end if the loop is switched. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53106 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the ability for ADCE to remove unreachable blocks in loop nests, ↵Owen Anderson2008-07-03
| | | | | | because, as Eli pointed out, SimplifyCFG already does this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53104 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused function.Bill Wendling2008-07-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53090 91177308-0d34-0410-b5e6-96231b3b80d8
* Preserve dom info.Devang Patel2008-07-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53089 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove extra FIXMEDevang Patel2008-07-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53087 91177308-0d34-0410-b5e6-96231b3b80d8
* Reconstruct dom info, if loop is unswitched.Devang Patel2008-07-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53086 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopUnswitch does not preserve dominator info in all cases.Devang Patel2008-07-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53085 91177308-0d34-0410-b5e6-96231b3b80d8
* Undo previous patch. It is not that simple to fix dom info here.Devang Patel2008-07-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53062 91177308-0d34-0410-b5e6-96231b3b80d8
* Preserve dom info while simplifing loop after the unswitch.Devang Patel2008-07-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53052 91177308-0d34-0410-b5e6-96231b3b80d8
* Use df_ext_iterator to capture the reachable set without allocating an extra ↵Owen Anderson2008-07-02
| | | | | | | | | | set. Also, move large sets and vectors out of instance variables and onto the stack, and give them more reasonable sizes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53044 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid a redundant call.Owen Anderson2008-07-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53040 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support to ADCE for pruning unreachable blocks. This addresses the finalOwen Anderson2008-07-02
| | | | | | | part of PR2509. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53038 91177308-0d34-0410-b5e6-96231b3b80d8
* Use DenseSet rather than SmallPtrSet for the alive set. Using SmallPtrSetOwen Anderson2008-07-02
| | | | | | | with a huge "size" parameter is actually quite inefficient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53034 91177308-0d34-0410-b5e6-96231b3b80d8
* A better fix for PR2503 that doesn't pessimize GVN in the presence of ↵Owen Anderson2008-07-02
| | | | | | unreachable blocks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53032 91177308-0d34-0410-b5e6-96231b3b80d8
* reuse vectors.Devang Patel2008-07-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53007 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix comment.Devang Patel2008-07-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53006 91177308-0d34-0410-b5e6-96231b3b80d8
* Preserve loop data so that it is not fetched everytime it is needed.Devang Patel2008-07-02
| | | | | | | Keep track of currentLoop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53005 91177308-0d34-0410-b5e6-96231b3b80d8
* - Re-apply 52748 and friends with fix. GetConstantStringInfo() returns an ↵Evan Cheng2008-06-30
| | | | | | | | | empty string for ConstantAggregateZero case which surprises selectiondag. - Correctly handle memcpy from constant string which is zero-initialized. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52891 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert (52748 and friends):Anton Korobeynikov2008-06-29
| | | | | | | | | | | | Move GetConstantStringInfo to lib/Analysis. Remove string output routine from Constant. Update all callers. Change debug intrinsic api slightly to accomodate move of routine, these now return values instead of strings. This unbreaks llvm-gcc bootstrap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52884 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused function.Eric Christopher2008-06-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52749 91177308-0d34-0410-b5e6-96231b3b80d8
* Move GetConstantStringInfo to lib/Analysis. RemoveEric Christopher2008-06-26
| | | | | | | | | | string output routine from Constant. Update all callers. Change debug intrinsic api slightly to accomodate move of routine, these now return values instead of strings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52748 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR2488, a case where we deleted stack restores too aggressively.Chris Lattner2008-06-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52702 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo in a comment.Dan Gohman2008-06-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52687 91177308-0d34-0410-b5e6-96231b3b80d8
* Use use_empty() instead of getNumUses(), avoiding a use list traversal.Dan Gohman2008-06-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52651 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix spelling and grammar in a comment.Dan Gohman2008-06-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52648 91177308-0d34-0410-b5e6-96231b3b80d8