aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
...
* Use ScalarEvolution::getConstant instead of getUnknown to createDan Gohman2009-06-241-7/+8
| | | | | | | | SCEVConstants. This cleanup is a step toward letting getUnknown be simpler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74037 91177308-0d34-0410-b5e6-96231b3b80d8
* Include the maximum trip count expression in ScalarEvolution's print output.Dan Gohman2009-06-241-0/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74035 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an isAllOnesValue utility function, similar to isZero and isOne.Dan Gohman2009-06-241-0/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74032 91177308-0d34-0410-b5e6-96231b3b80d8
* It is not a good idea to have data member's name match argument's name. In ↵Devang Patel2009-06-231-21/+21
| | | | | | fact, it is a simple receipe to waste an hour or so. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74018 91177308-0d34-0410-b5e6-96231b3b80d8
* Use getReturnTypeName() to print return type.Devang Patel2009-06-231-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74017 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug in the trip-count computation with And/Or. If either of theDan Gohman2009-06-221-8/+4
| | | | | | | sides is CouldNotCompute, the resulting exact count must be CouldNotCompute. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73920 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unneeded #include.Owen Anderson2009-06-221-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73911 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a few minor issues that were exposed by the removal of SCEVHandle.Dan Gohman2009-06-221-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73910 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix llvm::ComputeNumSignBits to handle pointer typesDan Gohman2009-06-221-1/+5
| | | | | | | conservatively correctly, instead of aborting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73908 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the parent pointer from SCEV, since it did not end up being needed.Owen Anderson2009-06-221-30/+22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73907 91177308-0d34-0410-b5e6-96231b3b80d8
* SCEVHandle is no more!Owen Anderson2009-06-224-311/+310
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73906 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some typos that Duncan noticed.Dan Gohman2009-06-221-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73903 91177308-0d34-0410-b5e6-96231b3b80d8
* Banish global state from ScalarEvolution! SCEV uniquing is now done by ↵Owen Anderson2009-06-221-58/+50
| | | | | | | | | | | | tables attached to the ScalarEvolution pass. This also throws out the SCEV reference counting scheme, as the the SCEVs now have a lifetime controlled by the ScalarEvolution pass. Note that SCEVHandle is now a no-op, and will be remove in a future commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73892 91177308-0d34-0410-b5e6-96231b3b80d8
* Make use of getUMinFromMismatchedTypes when computing backedge-takenDan Gohman2009-06-221-14/+14
| | | | | | | | | | | | | counts for loops with multiple exits, replacing more conservative code which only handled constants. This is derived from a patch by Nick Lewycky. This also fixes llc aborts in ClamAV and others, as getUMinFromMismatchedTypes takes care of balancing the types before working with them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73884 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a getUMinFromMismatchedTypes helper function.Dan Gohman2009-06-221-0/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73883 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out code for computing umin and smin for SCEV expressions intoDan Gohman2009-06-221-7/+14
| | | | | | | helper functions. Based on a patch by Nick Lewycky. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73869 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach ScalarEvolution how to analyze loops with multiple exitDan Gohman2009-06-221-27/+221
| | | | | | | | | | blocks, and also exit blocks with multiple conditions (combined with (bitwise) ands and ors). It's often infeasible to compute an exact trip count in such cases, but a useful upper bound can often be found. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73866 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete an unused variable.Dan Gohman2009-06-221-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73865 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix ScalarEvolution's backedge-taken count computations to check forDan Gohman2009-06-211-7/+29
| | | | | | | | | overflow when computing a integer division to round up. Thanks to Nick Lewycky for noticing this! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73862 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize isLoopGuardedByCond's checking to consider twoDan Gohman2009-06-201-3/+27
| | | | | | | | | | | SCEVUnknowns with identical Instructions to be equal. This allows it to analze cases such as the attached testcase, where the front-end has cloned the loop controlling expression. Along with r73805, this lets IndVarSimplify eliminate all the sign-extend casts in the loop in the attached testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73807 91177308-0d34-0410-b5e6-96231b3b80d8
* Use ScalarEvolution's new GetMinSignBits and GetMinLeadingZerosDan Gohman2009-06-201-3/+6
| | | | | | | | in the loop backedge-taken count computation of the maximum possible trip count. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73805 91177308-0d34-0410-b5e6-96231b3b80d8
* Make GetMinTrailingZeros a member function of ScalarEvolution,Dan Gohman2009-06-191-22/+83
| | | | | | | | | | | | so that it can access the TargetData member (when available) and use ValueTracking.h information to compute information for SCEVUnknown Values. Also add GetMinLeadingZeros and GetMinSignBits functions, with minimal implementations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73794 91177308-0d34-0410-b5e6-96231b3b80d8
* Make ScalarEvolution::print print getSCEVAtScope values forDan Gohman2009-06-191-2/+10
| | | | | | | expressions, when interesting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73776 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't (unconditionally) use getSCEVAtScope to simplify the stepDan Gohman2009-06-191-1/+0
| | | | | | | | | expression in IVUsers, because in the case of a use of a non-linear addrec outside of a loop, this causes the addrec to be evaluated as a linear addrec. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73774 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a parent pointer to SCEV, in preparation for getting rid of the global ↵Owen Anderson2009-06-181-21/+26
| | | | | | uniquing tables. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73728 91177308-0d34-0410-b5e6-96231b3b80d8
* Recognize n != 0 ? n : 1 as umax(n, 1). Previously only ULT/UGT/ULE/UGEDan Gohman2009-06-181-0/+18
| | | | | | | | comparisons were recognized for umax, but instcombine canonicalizes unsigned comparisons with zero to this simpler form. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73717 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the code from IVUsers that attempted to handleDan Gohman2009-06-181-27/+3
| | | | | | | | | | | | casted induction variables in cases where the cast isn't foldable. It ended up being a pessimization in many cases. This could be fixed, but it would require a bunch of complicated code in IVUsers' clients. The advantages of this approach aren't visible enough to justify it at this time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73706 91177308-0d34-0410-b5e6-96231b3b80d8
* Update a comment to reflect the code.Dan Gohman2009-06-181-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73704 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix trailing whitespace from ScalarEvolution::print.Dan Gohman2009-06-181-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73666 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach ScalarEvolution how to recognize another xor(and(x, C), C) case.Dan Gohman2009-06-181-4/+19
| | | | | | | | If C is a single bit and the and gets analyzed as a truncate and zero-extend, the xor can be represnted as an add. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73664 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete unnecessary braces.Dan Gohman2009-06-171-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73663 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix ScalarEvolution's Xor handling to not assume that an AndDan Gohman2009-06-171-3/+6
| | | | | | | | that gets recognized with a SCEVZeroExtendExpr must be an And with a low-bits mask. With r73540, this is no longer the case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73594 91177308-0d34-0410-b5e6-96231b3b80d8
* Instcombine's ShrinkDemandedConstant may strip bits out of constants,Dan Gohman2009-06-161-3/+18
| | | | | | | | | obscuring what would otherwise be a low-bits mask. Use ComputeMaskedBits to compute what ShrinkDemandedConstant knew about to reconstruct a low-bits mask value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73540 91177308-0d34-0410-b5e6-96231b3b80d8
* Support vector casts in more places, fixing a variety of assertionDan Gohman2009-06-154-18/+36
| | | | | | | | | | | | | | | | failures. To support this, add some utility functions to Type to help support vector/scalar-independent code. Change ConstantInt::get and ConstantFP::get to support vector types, and add an overload to ConstantInt::get that uses a static IntegerType type, for convenience. Introduce a new getConstant method for ScalarEvolution, to simplify common use cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73431 91177308-0d34-0410-b5e6-96231b3b80d8
* Code cleanups. getSCEVAtScope no longer uses SCEVCouldNotCompute.Dan Gohman2009-06-151-9/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73401 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix old-style type names in comments.Dan Gohman2009-06-141-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73362 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement more aggressive folding of add operand lists whenDan Gohman2009-06-141-0/+128
| | | | | | | | | | | they contain multiplications of constants with add operations. This helps simplify several kinds of things; in particular it helps simplify expressions like ((-1 * (%a + %b)) + %a) to %b, as expressions like this often come up in loop trip count computations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73361 91177308-0d34-0410-b5e6-96231b3b80d8
* Check for the short-circuiting condition before performingDan Gohman2009-06-141-1/+1
| | | | | | | the potentially expensive erase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73359 91177308-0d34-0410-b5e6-96231b3b80d8
* Do compare constant SCEV values in SCEVComplexityCompare, becauseDan Gohman2009-06-141-3/+12
| | | | | | | | | even though the order doesn't matter at the top level of an expression, it does matter when the constant is a subexpression of an n-ary expression, because n-ary expressions are sorted lexicographically. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73358 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert several parts of the ScalarEvolution framework to useDan Gohman2009-06-142-44/+50
| | | | | | | SmallVector instead of std::vector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73357 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach SCEVExpander's visitAddRecExpr to reuse an existing canonicalDan Gohman2009-06-131-8/+51
| | | | | | | | | | | | | | | | | | induction variable when the addrec to be expanded does not require a wider type. This eliminates the need for IndVarSimplify to micro-manage SCEV expansions, because SCEVExpander now automatically expands them in the form that IndVarSimplify considers to be canonical. (LSR still micro-manages its SCEV expansions, because it's optimizing for the target, rather than for other optimizations.) Also, this uses the new getAnyExtendExpr, which has more clever expression simplification logic than the IndVarSimplify code it replaces, and this cleans up some ugly expansions in code such as the included masked-iv.ll testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73294 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a ScalarEvolution::getAnyExtendExpr utility function for performingDan Gohman2009-06-131-0/+59
| | | | | | | extension with unspecified bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73293 91177308-0d34-0410-b5e6-96231b3b80d8
* Use expandCodeFor instead of expand when the result will beDan Gohman2009-06-091-29/+18
| | | | | | | | | | immediately casted. At present, this is just a minor code simplification. In the future, the expansion code may be able to make better choices if it knows what the desired result type will be. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73137 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename UnknownValue to CouldNotCompute, since it holds an instance ofDan Gohman2009-06-061-37/+37
| | | | | | | SCEVCouldNotCompute, and not SCEVUnknown. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72999 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify.Devang Patel2009-06-051-15/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72970 91177308-0d34-0410-b5e6-96231b3b80d8
* Move SCEVExpander::getOrInsertCanonicalInductionVariable out of line.Dan Gohman2009-06-051-0/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72949 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some unnecessary #includes.Dan Gohman2009-06-053-3/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72948 91177308-0d34-0410-b5e6-96231b3b80d8
* Split the Add, Sub, and Mul instruction opcodes into separateDan Gohman2009-06-041-1/+1
| | | | | | | | | | | | | | | | integer and floating-point opcodes, introducing FAdd, FSub, and FMul. For now, the AsmParser, BitcodeReader, and IRBuilder all preserve backwards compatability, and the Core LLVM APIs preserve backwards compatibility for IR producers. Most front-ends won't need to change immediately. This implements the first step of the plan outlined here: http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72897 91177308-0d34-0410-b5e6-96231b3b80d8
* Change ConstantFoldConstantExpression to accept a nullDan Gohman2009-06-021-2/+0
| | | | | | | | | | | | TargetData pointer. The only thing it's used for are calls to ConstantFoldCompareInstOperands and ConstantFoldInstOperands, which both already accept a null TargetData pointer. This makes ConstantFoldConstantExpression easier to use in clients where TargetData is optional. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72741 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete an obsolete sentance from a comment.Dan Gohman2009-05-311-3/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72667 91177308-0d34-0410-b5e6-96231b3b80d8