summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* Make ScalarEvolution::print print getSCEVAtScope values forDan Gohman2009-06-191-2/+10
| | | | | | expressions, when interesting. llvm-svn: 73776
* 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. llvm-svn: 73774
* 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. llvm-svn: 73728
* 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. llvm-svn: 73717
* 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. llvm-svn: 73706
* Update a comment to reflect the code.Dan Gohman2009-06-181-2/+1
| | | | llvm-svn: 73704
* Fix trailing whitespace from ScalarEvolution::print.Dan Gohman2009-06-181-2/+1
| | | | llvm-svn: 73666
* 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. llvm-svn: 73664
* Delete unnecessary braces.Dan Gohman2009-06-171-2/+1
| | | | llvm-svn: 73663
* 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. llvm-svn: 73594
* 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. llvm-svn: 73540
* 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. llvm-svn: 73431
* Code cleanups. getSCEVAtScope no longer uses SCEVCouldNotCompute.Dan Gohman2009-06-151-9/+9
| | | | llvm-svn: 73401
* Fix old-style type names in comments.Dan Gohman2009-06-141-1/+1
| | | | llvm-svn: 73362
* 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. llvm-svn: 73361
* Check for the short-circuiting condition before performingDan Gohman2009-06-141-1/+1
| | | | | | the potentially expensive erase. llvm-svn: 73359
* 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. llvm-svn: 73358
* Convert several parts of the ScalarEvolution framework to useDan Gohman2009-06-142-44/+50
| | | | | | SmallVector instead of std::vector. llvm-svn: 73357
* 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. llvm-svn: 73294
* Add a ScalarEvolution::getAnyExtendExpr utility function for performingDan Gohman2009-06-131-0/+59
| | | | | | extension with unspecified bits. llvm-svn: 73293
* 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. llvm-svn: 73137
* Rename UnknownValue to CouldNotCompute, since it holds an instance ofDan Gohman2009-06-061-37/+37
| | | | | | SCEVCouldNotCompute, and not SCEVUnknown. llvm-svn: 72999
* Simplify.Devang Patel2009-06-051-15/+6
| | | | llvm-svn: 72970
* Move SCEVExpander::getOrInsertCanonicalInductionVariable out of line.Dan Gohman2009-06-051-0/+13
| | | | llvm-svn: 72949
* Remove some unnecessary #includes.Dan Gohman2009-06-053-3/+0
| | | | llvm-svn: 72948
* 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 llvm-svn: 72897
* 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. llvm-svn: 72741
* Delete an obsolete sentance from a comment.Dan Gohman2009-05-311-3/+1
| | | | llvm-svn: 72667
* Add braces around an array initializer.Dan Gohman2009-05-271-1/+1
| | | | llvm-svn: 72453
* Teach SCEVExpander to avoid creating over-indexed GEP indices whenDan Gohman2009-05-271-10/+25
| | | | | | | | | | | | possible. For example, it now emits %p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 2, i64 %tmp, i64 1 instead of the equivalent but less obvious %p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 %tmp, i64 19 llvm-svn: 72452
* Teach BasicAliasAnalysis to understand constant gep indices that fallDan Gohman2009-05-271-4/+25
| | | | | | | | | | | | | beyond their associated static array type. I believe that this fixes a legitimate bug, because BasicAliasAnalysis already has code to check for this condition that works for non-constant indices, however it was missing the case of constant indices. With this change, it checks for both. This fixes PR4267, and miscompiles of SPEC 188.ammp and 464.h264.href. llvm-svn: 72451
* For the return type of SCEVUDivExpr, use the RHS' type instead ofDan Gohman2009-05-261-1/+6
| | | | | | | | that of the LHS. It doesn't matter for correctness, but the LHS is more likely than the RHS to be a pointer type in exotic cases, and it's more tidy to have it return the integer type. llvm-svn: 72424
* In cases where a pointer value is an operand of a multiplication orDan Gohman2009-05-261-3/+8
| | | | | | | division operation, don't attempt to use the operation's value as the base of a getelementptr. This fixes PR4271. llvm-svn: 72422
* make memdep use the getModRefInfo method for stores instead of theChris Lattner2009-05-251-1/+9
| | | | | | | low-level alias() method, allowing it to reason more aggressively about pointers into constant memory. PR4189 llvm-svn: 72403
* Various comment fixes.Dan Gohman2009-05-241-9/+14
| | | | llvm-svn: 72376
* Change ScalarEvolution::getSCEVAtScope to always return the original valueDan Gohman2009-05-241-21/+8
| | | | | | | | in the case where a loop exit value cannot be computed, instead of only in some cases while using SCEVCouldNotCompute in others. This simplifies getSCEVAtScope's callers. llvm-svn: 72375
* Instead of clearing the rewriter, don't attempt to rewrite dead phi nodes.Torok Edwin2009-05-241-1/+2
| | | | | | Also fix 80 column violation. llvm-svn: 72371
* Fix this code for hosts where std::vector doesn't have .data().Dan Gohman2009-05-241-1/+1
| | | | | | Use &Ops[0] instead, which is safe since Ops will never be empty here. llvm-svn: 72368
* Generalize SCEVExpander::visitAddRecExpr's GEP persuit, and avoidDan Gohman2009-05-241-51/+140
| | | | | | | | | | | | | | | sending SCEVUnknowns to expandAddToGEP. This avoids the need for expandAddToGEP to bend the rules and peek into SCEVUnknown expressions. Factor out the code for testing whether a SCEV can be factored by a constant for use in a GEP index. This allows it to handle SCEVAddRecExprs, by recursing. As a result, SCEVExpander can now put more things in GEP indices, so it emits fewer explicit mul instructions. llvm-svn: 72366
* When the low bits of one operand of an add are zero, that numberDan Gohman2009-05-241-10/+31
| | | | | | of low bits of the other operand are preserved in the output. llvm-svn: 72365
* The rewriter may hold references to instructions that are deleted because ↵Torok Edwin2009-05-241-1/+1
| | | | | | | | | | | they are trivially dead. Fix by clearing the rewriter cache before deleting the trivially dead instructions. Also make InsertedExpressions use an AssertingVH to catch these bugs easier. llvm-svn: 72364
* Fix a thinko in the code that adapted SCEVMulExpr operands forDan Gohman2009-05-221-3/+13
| | | | | | | use in expanding SCEVAddExprs with GEPs. The operands of a SCEVMulExpr need to be multiplied together, not added. llvm-svn: 72250
* Use v.data() instead of &v[0] when SmallVector v might be empty.Jay Foad2009-05-212-6/+6
| | | | llvm-svn: 72210
* Teach ValueTracking a new way to analyze PHI nodes, and and teachDan Gohman2009-05-211-2/+27
| | | | | | | | Instcombine to be more aggressive about using SimplifyDemandedBits on shift nodes. This allows a shift to be simplified to zero in the included test case. llvm-svn: 72204
* Teach SCEV::isLoopInvariant and SCEV::hasComputableLoopEvolutionDan Gohman2009-05-201-2/+6
| | | | | | | about the convention from LoopInfo that a null Loop* means the entire function body. llvm-svn: 72152
* Make SCEVCallbackVH a private nested class inside ScalarEvolution, asDan Gohman2009-05-191-3/+3
| | | | | | it's an implementation detail. llvm-svn: 72122
* Create ConstantExpr GEPs the correct way. This fixesDan Gohman2009-05-191-1/+1
| | | | | | | MultiSource/Benchmarks/Prolangs-C/football and a variety of other failures. llvm-svn: 72120
* Teach SCEVExpander to expand arithmetic involving pointers into GEPDan Gohman2009-05-192-16/+168
| | | | | | | | | | | | | | | | instructions. It attempts to create high-level multi-operand GEPs, though in cases where this isn't possible it falls back to casting the pointer to i8* and emitting a GEP with that. Using GEP instructions instead of ptrtoint+arithmetic+inttoptr helps pointer analyses that don't use ScalarEvolution, such as BasicAliasAnalysis. Also, make the AddrModeMatcher more aggressive in handling GEPs. Previously it assumed that operand 0 of a GEP would require a register in almost all cases. It now does extra checking and can do more matching if operand 0 of the GEP is foldable. This fixes a problem that was exposed by SCEVExpander using GEPs. llvm-svn: 72093
* Silence Release-Asserts warnings.Daniel Dunbar2009-05-181-0/+1
| | | | llvm-svn: 72011
* Teach ScalarEvolution to recognize x^-1 in the case where non-demandedDan Gohman2009-05-181-0/+13
| | | | | | bits have been stripped out by instcombine. llvm-svn: 72010
OpenPOWER on IntegriCloud