aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
Commit message (Collapse)AuthorAgeFilesLines
* The accumulator tail recursion transform claims to work for any associativeDuncan Sands2010-07-101-14/+14
| | | | | | | | | | | | | | | | | operation, but the way it's implemented requires the operation to also be commutative. So add a check for commutativity (and tweak the corresponding comments). This makes no difference in practice since every associative LLVM instruction is also commutative! Here's an example to show the need for commutativity: the accum_recursion.ll testcase calculates the factorial function. Before the transformation the result of a call is ((((1*1)*2)*3)...)*x while afterwards it is (((1*x)*(x-1))...*2)*1 which clearly requires both associativity and commutativity of * to be equal to the original. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108056 91177308-0d34-0410-b5e6-96231b3b80d8
* cache result of operator*Gabor Greif2010-07-091-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107976 91177308-0d34-0410-b5e6-96231b3b80d8
* cache result of operator* (found by inspection)Gabor Greif2010-07-091-2/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107971 91177308-0d34-0410-b5e6-96231b3b80d8
* cache result of operator*Gabor Greif2010-07-091-6/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107969 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the second half of PR7437: scalarrepl wasn't preservingChris Lattner2010-07-081-21/+9
| | | | | | | address spaces when SRoA'ing memcpy's. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107846 91177308-0d34-0410-b5e6-96231b3b80d8
* Detabify this file.Nick Lewycky2010-07-061-7/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107637 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't claim to preserve AliasAnalysis. First, this is doesn't actuallyDan Gohman2010-07-021-1/+0
| | | | | | | | have any effect, and second, deleting stores can potentially invalidate an AliasAnalysis, and there's currently no notification for this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107496 91177308-0d34-0410-b5e6-96231b3b80d8
* use ArgOperand APIGabor Greif2010-06-301-10/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107278 91177308-0d34-0410-b5e6-96231b3b80d8
* use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperandGabor Greif2010-06-301-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107273 91177308-0d34-0410-b5e6-96231b3b80d8
* use getNumArgOperands instead of getNumOperandsGabor Greif2010-06-301-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107272 91177308-0d34-0410-b5e6-96231b3b80d8
* use getArgOperand instead of getOperandGabor Greif2010-06-301-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107271 91177308-0d34-0410-b5e6-96231b3b80d8
* use getArgOperand instead of getOperandGabor Greif2010-06-301-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107270 91177308-0d34-0410-b5e6-96231b3b80d8
* employ CallInst::ArgOffset (for now)Gabor Greif2010-06-281-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107015 91177308-0d34-0410-b5e6-96231b3b80d8
* use cached valueGabor Greif2010-06-281-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107000 91177308-0d34-0410-b5e6-96231b3b80d8
* minor cleanup to SROA: when lowering type unsafe accesses toChris Lattner2010-06-271-1/+6
| | | | | | | | | large integers, the first inserted value would always create an 'or X, 0'. Even though this is trivially zapped by instcombine, don't bother creating this pointless instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106979 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR7328: when turning a tail recursion into a loop, need to preserveDuncan Sands2010-06-261-6/+6
| | | | | | | | | the returned value after the tail call if it differs from other return values. The optimal thing to do would be to introduce a phi node for the return value, but for the moment just fix the miscompile. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106947 91177308-0d34-0410-b5e6-96231b3b80d8
* In GenerateReassociations, don't bother thinking about individualDan Gohman2010-06-251-8/+22
| | | | | | | | | SCEVUnknown values which are loop-variant, as LSR can't do anything interesting with these values in any case. This fixes very slow compile times on loops which have large numbers of such values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106897 91177308-0d34-0410-b5e6-96231b3b80d8
* The hasMemory argument is irrelevant to how the argumentDale Johannesen2010-06-251-2/+1
| | | | | | | | | | | for an "i" constraint should get lowered; PR 6309. While this argument was passed around a lot, this is the only place it was used, so it goes away from a lot of other places. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106893 91177308-0d34-0410-b5e6-96231b3b80d8
* use ArgOperand API; tighten type of handleFreeWithNonTrivialDependency to be ↵Gabor Greif2010-06-251-5/+7
| | | | | | able to use isFreeCall whithout a cast or new overload git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106823 91177308-0d34-0410-b5e6-96231b3b80d8
* A few minor micro-optimizations.Dan Gohman2010-06-241-5/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106764 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach getExactSDiv to evaluate x/1 to x up front, as it's a commonDan Gohman2010-06-241-8/+16
| | | | | | | | enough special case, and it theoretically allows more folding because it works even when x is unanalyzable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106763 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix copy+pasto issues in isMulSExtable.Dan Gohman2010-06-241-4/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106759 91177308-0d34-0410-b5e6-96231b3b80d8
* use ArgOperand API; introduce downcasted pointers into scope to facilitate thisGabor Greif2010-06-241-7/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106734 91177308-0d34-0410-b5e6-96231b3b80d8
* use ArgOperand APIGabor Greif2010-06-241-75/+75
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106731 91177308-0d34-0410-b5e6-96231b3b80d8
* use ArgOperand APIGabor Greif2010-06-241-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106730 91177308-0d34-0410-b5e6-96231b3b80d8
* use callsite to obtain all argumentsGabor Greif2010-06-241-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106729 91177308-0d34-0410-b5e6-96231b3b80d8
* use getNumArgOperandsGabor Greif2010-06-241-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106709 91177308-0d34-0410-b5e6-96231b3b80d8
* use ArgOperand APIGabor Greif2010-06-242-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106707 91177308-0d34-0410-b5e6-96231b3b80d8
* Use ValueMap instead of DenseMap.Devang Patel2010-06-242-23/+23
| | | | | | | The ValueMapper used by various cloning utility maps MDNodes also. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106706 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix OptimizeMax to handle an odd case where one of the max operandsDan Gohman2010-06-221-1/+4
| | | | | | | is another max which folds. This fixes PR7454. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106594 91177308-0d34-0410-b5e6-96231b3b80d8
* Use pre-increment instead of post-increment when the result is not used.Dan Gohman2010-06-228-37/+37
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106542 91177308-0d34-0410-b5e6-96231b3b80d8
* Use A.append(...) instead of A.insert(A.end(), ...) when A is aDan Gohman2010-06-211-7/+6
| | | | | | | SmallVector, and other SmallVector simplifications. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106452 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a TODO comment.Dan Gohman2010-06-191-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106397 91177308-0d34-0410-b5e6-96231b3b80d8
* Include the use kind along with the expression in the key of theDan Gohman2010-06-191-2/+28
| | | | | | | | | | | | | use sharing map. The reconcileNewOffset logic already forces a separate use if the kinds differ, so incorporating the kind in the key means we can track more sharing opportunities. More sharing means fewer total uses to track, which means smaller problem sizes, which means the conservative throttles don't kick in as often. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106396 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't include things in anonymous namespaces that don't need it.Dan Gohman2010-06-191-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106395 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable indvars on loops when LoopSimplify form is not available.Dan Gohman2010-06-181-0/+11
| | | | | | | This fixes PR7333. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106267 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure that simplify libcalls does not replace a call with one callingRafael Espindola2010-06-161-0/+5
| | | | | | convention with a new call with a different calling convention. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106134 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify-libcalls: fold strncmp(x, y, 1) -> memcmp(x, y, 1)Benjamin Kramer2010-06-161-0/+3
| | | | | | | | The memcmp will be optimized further and even the pathological case 'strstr(x, "x") == x' generates optimal code now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106097 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify-libcalls: fold strstr(a, b) == a -> strncmp(a, b, strlen(b)) == 0Benjamin Kramer2010-06-151-0/+31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106047 91177308-0d34-0410-b5e6-96231b3b80d8
* jump threading can't split a critical edge from an indirectbr. ThisChris Lattner2010-06-141-1/+6
| | | | | | | fixes PR7356. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105950 91177308-0d34-0410-b5e6-96231b3b80d8
* SimplifyCFG: don't turn volatile stores to null/undef into unreachable. ↵Benjamin Kramer2010-06-131-0/+3
| | | | | | Fixes PR7369. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105914 91177308-0d34-0410-b5e6-96231b3b80d8
* Pulled CodeMetrics out of InlineCost.h and made it a bit more general, so it ↵Kenneth Uildriks2010-06-091-1/+1
| | | | | | can be reused from PartialSpecializationCost git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105725 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't track users of undef values; they aren't interesting forDan Gohman2010-06-041-1/+5
| | | | | | | register pressure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105501 91177308-0d34-0410-b5e6-96231b3b80d8
* Move FindAvailableLoadedValue isSafeToLoadUnconditionally out ofDan Gohman2010-05-283-0/+3
| | | | | | | | lib/Transforms/Utils and into lib/Analysis so that Analysis passes can use them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104949 91177308-0d34-0410-b5e6-96231b3b80d8
* Kill unneeded SExt.Benjamin Kramer2010-05-261-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104692 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly promote operands when optimizing a single-character memcmp.Benjamin Kramer2010-05-251-3/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104648 91177308-0d34-0410-b5e6-96231b3b80d8
* DominatorTree.getNode can return null for unreachable blocks.Dan Gohman2010-05-201-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104290 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor code cleanups.Dan Gohman2010-05-201-8/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104287 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Solve check its own post-condition, to reduce clutter in theDan Gohman2010-05-201-1/+2
| | | | | | | top-level LSRInstance logic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104278 91177308-0d34-0410-b5e6-96231b3b80d8
* Add comments.Dan Gohman2010-05-201-0/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104276 91177308-0d34-0410-b5e6-96231b3b80d8