summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Delete a redundant 'else'.Dan Gohman2009-05-181-1/+1
| | | | llvm-svn: 72009
* Fix ScalarEvolution::isLoopGuardedByCond to accept a null Loop*, forDan Gohman2009-05-181-0/+4
| | | | | | | consistency with other routines that use a null Loop* to mean code not contained by any loop. llvm-svn: 72008
* Minor code cleanups. Do more of the work before the if statementsDan Gohman2009-05-181-16/+21
| | | | | | instead of within their controlling expressions. llvm-svn: 72007
* Add assertion checks to the SCEV operator creation methods to catchDan Gohman2009-05-181-0/+34
| | | | | | type mismatches. llvm-svn: 72006
* Make ScalarEvolution::isLoopGuardedByCond work even when the edgeDan Gohman2009-05-181-13/+27
| | | | | | entering a loop is a non-split critical edge. llvm-svn: 72004
* Add an isOne() utility function to ScalarEvolution, similar to isZero()Dan Gohman2009-05-181-1/+6
| | | | | | and similar to ConstantInt's isOne(). llvm-svn: 72003
* Non-functionality changes:Bill Wendling2009-05-141-110/+85
| | | | | | | | - Reformatting. - Use while() instead of do-while(). - Move simple constructors into .h file. llvm-svn: 71782
* Clean up this file fixing 80-column violations, bad formatting, etc. No ↵Bill Wendling2009-05-141-60/+69
| | | | | | functionality change. llvm-svn: 71781
* Avoid getting a compiler warningDuncan Sands2009-05-131-1/+1
| | | | | | | | IVUsers.cpp: In member function ‘bool llvm::IVUsers::AddUsersIfInteresting(llvm::Instruction*)’: IVUsers.cpp:221: warning: ‘isSigned’ may be used uninitialized in this function with gcc-4.3. llvm-svn: 71654
* add IVUsers.cppChris Lattner2009-05-131-0/+1
| | | | llvm-svn: 71646
* Add three new helper routines, getNoopOrZeroExtend,Dan Gohman2009-05-131-0/+47
| | | | | | | | | getNoopOrSignExtend, and getTruncateOrNoop. These are similar to getTruncateOrZeroExtend etc., except that they assert that the conversion is either not widening or narrowing, as appropriate. These will be used in some upcoming fixes. llvm-svn: 71632
* Factor the code for collecting IV users out of LSR into an IVUsers class,Dan Gohman2009-05-121-0/+391
| | | | | | | | | | | | | | | | | | | | | | | | and generalize it so that it can be used by IndVarSimplify. Implement the base IndVarSimplify transformation code using IVUsers. This removes TestOrigIVForWrap and associated code, as ScalarEvolution now has enough builtin overflow detection and folding logic to handle all the same cases, and more. Run "opt -iv-users -analyze -disable-output" on your favorite loop for an example of what IVUsers does. This lets IndVarSimplify eliminate IV casts and compute trip counts in more cases. Also, this happens to finally fix the remaining testcases in PR1301. Now that IndVarSimplify is being more aggressive, it occasionally runs into the problem where ScalarEvolutionExpander's code for avoiding duplicate expansions makes it difficult to ensure that all expanded instructions dominate all the instructions that will use them. As a temporary measure, IndVarSimplify now uses a FixUsesBeforeDefs function to fix up instructions inserted by SCEVExpander. Fortunately, this code is contained, and can be easily removed once a more comprehensive solution is available. llvm-svn: 71535
* When forgetting SCEVs for loop PHIs, don't forget SCEVUnknown values.Dan Gohman2009-05-121-2/+12
| | | | | | | | | These values aren't analyzable, so they don't care if more information about the loop trip count can be had. Also, SCEVUnknown is used for a PHI while the PHI itself is being analyzed, so it needs to be left in the Scalars map. This fixes a variety of subtle issues. llvm-svn: 71533
* Fix GetMinTrailingZeros for SCEVSignExtend and SCEVZeroExtendExpr toDan Gohman2009-05-121-2/+2
| | | | | | | | | | return the correct value when the cast operand is all zeros. This ought to be pretty rare, because it would mean that the regular SCEV folding routines missed a case, though there are cases they might legitimately miss. Also, it's unlikely anything currently using GetMinTrailingZeros cares about this case. llvm-svn: 71532
* Allow scalar evolution to compute iteration counts for loops with a Eli Friedman2009-05-091-19/+8
| | | | | | pointer-based condition. This fixes PR3171. llvm-svn: 71354
* Rename PaddedSize to AllocSize, in the hope that thisDuncan Sands2009-05-094-6/+6
| | | | | | | will make it more obvious what it represents, and stop it being confused with the StoreSize. llvm-svn: 71349
* Don't attempt to handle unsized types in ScalarEvolution's GEP analyzer.Dan Gohman2009-05-091-0/+3
| | | | llvm-svn: 71302
* Fix bogus overflow checks by replacing them with actualDan Gohman2009-05-081-7/+18
| | | | | | overflow checks. llvm-svn: 71284
* Fold trunc casts into add-recurrence expressions, allowing theDan Gohman2009-05-081-8/+62
| | | | | | | add-recurrence to be exposed. Add a new SCEV folding rule to help simplify expressions in the presence of these extra truncs. llvm-svn: 71264
* Fix another bug in r71252. This code supports GetElementPtrDan Gohman2009-05-081-2/+2
| | | | | | constant exprs as well as instructions. llvm-svn: 71262
* Add memoization for getSCEVAtScope results for instructionsDan Gohman2009-05-081-0/+15
| | | | | | | | | which are not analyzed with SCEV techniques, which can require brute-forcing through a large number of instructions. This fixes a massive compile-time issue on 400.perlbench (in particular, the loop in MD5Transform). llvm-svn: 71259
* Make the SCEV* form of getSCEVAtScope public, to allow ScalarEvolutionDan Gohman2009-05-081-13/+12
| | | | | | clients to use it. llvm-svn: 71258
* Fix an error from r71252.Dan Gohman2009-05-081-4/+4
| | | | llvm-svn: 71255
* Print out nicer dump info for DIDescriptor.Bill Wendling2009-05-081-1/+2
| | | | llvm-svn: 71253
* Factor out the code for creating SCEVs for GEPs into aDan Gohman2009-05-081-33/+40
| | | | | | separate function. llvm-svn: 71252
* Implement several new SCEV folding rules for UDiv SCEVs.Dan Gohman2009-05-081-2/+54
| | | | | | This fixes an old FIXME, and is needed by some upcoming changes. llvm-svn: 71247
* Revert 71165. It did more than just revert 71158 and it introducedDan Gohman2009-05-072-35/+37
| | | | | | several regressions. The problem due to 71158 is now fixed. llvm-svn: 71176
* SCEVComplexityCompare's new code was missing SCEVUDivExpr. ImplementDan Gohman2009-05-071-0/+14
| | | | | | the SCEVUDivExpr case. llvm-svn: 71173
OpenPOWER on IntegriCloud