summaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolutionExpander.cpp
Commit message (Collapse)AuthorAge
* Introduce memoization for ScalarEvolution dominates and properlyDominatesDan Gohman2010-11-18
| | | | | | | queries, and SCEVExpander getRelevantLoop queries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119595 91177308-0d34-0410-b5e6-96231b3b80d8
* Move SCEV::dominates and properlyDominates to ScalarEvolution.Dan Gohman2010-11-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119570 91177308-0d34-0410-b5e6-96231b3b80d8
* Move SCEV::isLoopInvariant and hasComputableLoopEvolution to be memberDan Gohman2010-11-17
| | | | | | | | functions of ScalarEvolution, in preparation for memoization and other optimizations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119562 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix SCEVExpander::visitAddRecExpr so that it remembers the induction variableDan Gohman2010-07-26
| | | | | | | | | it inserted rather than using LoopInfo::getCanonicalInductionVariable to rediscover it, since that doesn't work on non-canonical loops. This fixes infinite recurrsion on such loops; PR7562. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109419 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify this code; LoopInfo::getCanonicalInductionVariable will onlyDan Gohman2010-07-20
| | | | | | | find integer induction variables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108853 91177308-0d34-0410-b5e6-96231b3b80d8
* Make getOrInsertCanonicalInductionVariable guarantee that itsDan Gohman2010-07-20
| | | | | | | result is a PHINode*. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108852 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the order that SCEVExpander considers add operands in so thatDan Gohman2010-07-15
| | | | | | | | it doesn't miss an opportunity to form a GEP, regardless of the relative loop depths of the operands. This fixes rdar://8197217. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108475 91177308-0d34-0410-b5e6-96231b3b80d8
* remove useless cast and fix typos in commentGabor Greif2010-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107989 91177308-0d34-0410-b5e6-96231b3b80d8
* cache result of operator*Gabor Greif2010-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107988 91177308-0d34-0410-b5e6-96231b3b80d8
* cache result of operator*Gabor Greif2010-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107976 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify.Dan Gohman2010-06-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107248 91177308-0d34-0410-b5e6-96231b3b80d8
* Use A.append(...) instead of A.insert(A.end(), ...) when A is aDan Gohman2010-06-21
| | | | | | | SmallVector, and other SmallVector simplifications. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106452 91177308-0d34-0410-b5e6-96231b3b80d8
* Restore a call to rememberInstruction which was accidentally droppedDan Gohman2010-06-19
| | | | | | | in refactoring. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106398 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out duplicated code for reusing and inserting casts intoDan Gohman2010-06-19
| | | | | | | a helper function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106388 91177308-0d34-0410-b5e6-96231b3b80d8
* A few more places where SCEVExpander bits need to skip over debug intrinsicsJim Grosbach2010-06-16
| | | | | | when iterating through instructions. Yet more work for rdar://7797940 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106149 91177308-0d34-0410-b5e6-96231b3b80d8
* LSR needs to remember inserted instructions even in postinc mode, becauseDan Gohman2010-06-05
| | | | | | | | there could be multiple subexpressions within a single expansion which require insert point adjustment. This fixes PR7306. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105510 91177308-0d34-0410-b5e6-96231b3b80d8
* Use getConstant instead of getIntegerSCEV. The two are basically theDan Gohman2010-05-03
| | | | | | | same, now that getConstant has overloads consistent with ConstantInt::get. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102965 91177308-0d34-0410-b5e6-96231b3b80d8
* When checking whether the special handling for an addrec increment whichDan Gohman2010-04-26
| | | | | | | | | | doesn't dominate the header is needed, don't check whether the increment expression has computable loop evolution. While the operands of an addrec are required to be loop-invariant, they're not required to dominate any part of the loop. This fixes PR6914. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102389 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bunch of namespace polution.Dan Gohman2010-04-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101376 91177308-0d34-0410-b5e6-96231b3b80d8
* When emitting code for an add, don't force a SCEVUnknown wrapper aroundDan Gohman2010-04-09
| | | | | | | | a hoisted intermediate result if the intermediate result isn't an Instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100884 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment.Dan Gohman2010-04-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100874 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize IVUsers to track arbitrary expressions rather than expressionsDan Gohman2010-04-07
| | | | | | | | | | | | | | | | explicitly split into stride-and-offset pairs. Also, add the ability to track multiple post-increment loops on the same expression. This refines the concept of "normalizing" SCEV expressions used for to post-increment uses, and introduces a dedicated utility routine for normalizing and denormalizing expressions. This fixes the expansion of expressions which are post-increment users of more than one loop at a time. More broadly, this takes LSR another step closer to being able to reason about more than one loop at a time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100699 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't back past debug info intrinsics; SCEVExpander's strategyDan Gohman2010-03-23
| | | | | | | | for ignoring debug info intrinsics everywhere else is to advance past them, and it needs to be consistent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99332 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix more places to more thoroughly ignore debug intrinsics. This fixesDan Gohman2010-03-19
| | | | | | | | | use-before-def errors in SCEVExpander-produced code in sqlite3 when debug info with optimization is enabled, though the testcases for this are dependent on use-list order. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99001 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r98755 with a thinko which miscompiled gengtype fixed.Dan Gohman2010-03-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98793 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 98755, which may be causing trouble.Dan Gohman2010-03-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98762 91177308-0d34-0410-b5e6-96231b3b80d8
* Change SCEVNAryExpr's operand array from a SmallVector to a plainDan Gohman2010-03-17
| | | | | | | | | | | pointer and length, and allocate the arrays in ScalarEvolution's BumpPtrAllocator, so that they get released when their owning SCEV gets released. SCEVs are immutable, so they don't need to worry about operand array resizing. This fixes a memory leak reported in PR6637. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98755 91177308-0d34-0410-b5e6-96231b3b80d8
* Another place where debug info affected codegen.Dale Johannesen2010-03-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98026 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix another case where LSR was affected by debug info.Dale Johannesen2010-03-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97865 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a case where LSR is sensitive to debug info.Dale Johannesen2010-03-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97830 91177308-0d34-0410-b5e6-96231b3b80d8
* Make SCEVExpander and LSR more aggressive about hoisting expressions outDan Gohman2010-03-03
| | | | | | | of loops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97642 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r97580; that's not the right way to fix this.Dan Gohman2010-03-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97639 91177308-0d34-0410-b5e6-96231b3b80d8
* When expanding an expression such as (A + B + C + D), sort the operandsDan Gohman2010-03-02
| | | | | | | | by loop depth and emit loop-invariant subexpressions outside of loops. This speeds up MultiSource/Applications/viterbi and others. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97580 91177308-0d34-0410-b5e6-96231b3b80d8
* Non-affine post-inc SCEV expansions have more code which must beDan Gohman2010-03-02
| | | | | | | | emitted after the increment. Make sure the insert position reflects this. This fixes PR6453. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97537 91177308-0d34-0410-b5e6-96231b3b80d8
* Spelling fixes.Dan Gohman2010-03-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97453 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix SCEVExpander's existing PHI reuse checking to recognize theDan Gohman2010-02-17
| | | | | | | | | case where there are loop-invariant instructions somehow left inside the loop, and in a position where they won't dominate the IV increment position. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96448 91177308-0d34-0410-b5e6-96231b3b80d8
* There are two ways of checking for a given type, for example isa<PointerType>(T)Duncan Sands2010-02-16
| | | | | | | | and T->isPointerTy(). Convert most instances of the first form to the second form. Requested by Chris. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96344 91177308-0d34-0410-b5e6-96231b3b80d8
* When reusing an existing PHI node in a loop, be even moreDan Gohman2010-02-16
| | | | | | | strict about the requirements. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96301 91177308-0d34-0410-b5e6-96231b3b80d8
* Uniformize the names of type predicates: rather than having isFloatTy andDuncan Sands2010-02-15
| | | | | | | isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96223 91177308-0d34-0410-b5e6-96231b3b80d8
* When restoring a saved insert location, check to see if the savedDan Gohman2010-02-15
| | | | | | | | insert location has become an "inserted" instruction since the time it was saved. If so, advance to the first non-"inserted" instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96203 91177308-0d34-0410-b5e6-96231b3b80d8
* In rememberInstruction, if the value being remembered is theDan Gohman2010-02-14
| | | | | | | | | | current insertion point, advance the current insertion point. This avoids a use-before-def situation in a testcase extracted from clang which is difficult to reduce to a reasonable-sized regression test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96151 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a case of mismatched types in an Add that turned up in 447.dealII.Dan Gohman2010-02-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96007 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply the new LoopStrengthReduction code, with compile time andDan Gohman2010-02-12
| | | | | | | | | | | bug fixes, and with improved heuristics for analyzing foreign-loop addrecs. This change also flattens IVUsers, eliminating the stride-oriented groupings, which makes it easier to work with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95975 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize target-independent folding rules for sizeof to handle moreDan Gohman2010-02-01
| | | | | | | | | | | | | | | | | | | | cases, and implement target-independent folding rules for alignof and offsetof. Also, reassociate reassociative operators when it leads to more folding. Generalize ScalarEvolution's isOffsetOf to recognize offsetof on arrays. Rename getAllocSizeExpr to getSizeOfExpr, and getFieldOffsetExpr to getOffsetOfExpr, for consistency with analagous ConstantExpr routines. Make the target-dependent folder promote GEP array indices to pointer-sized integers, to make implicit casting explicit and exposed to subsequent folding. And add a bunch of testcases for this new functionality, and a bunch of related existing functionality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94987 91177308-0d34-0410-b5e6-96231b3b80d8
* Check Type::isSized before calling ScalarEvolution::getAllocSizeExpr,Dan Gohman2010-01-28
| | | | | | | rather than after. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94742 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove SCEVAllocSizeExpr and SCEVFieldOffsetExpr, and in their placeDan Gohman2010-01-28
| | | | | | | | | | | | | | | | | use plain SCEVUnknowns with ConstantExpr::getSizeOf and ConstantExpr::getOffsetOf constants. This eliminates a bunch of special-case code. Also add code for pattern-matching these expressions, for clients that want to recognize them. Move ScalarEvolution's logic for expanding array and vector sizeof expressions into an element count times the element size, to expose the multiplication to subsequent folding, into the regular constant folder. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94737 91177308-0d34-0410-b5e6-96231b3b80d8
* When re-using an existing cast for a user, it's still necessary to callDan Gohman2010-01-21
| | | | | | | | rememberInstruction so that future users of that user will be inserted in the correct position. This fixes the Darwin selfhost. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94070 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-implement the main strength-reduction portion of LoopStrengthReduction.Dan Gohman2010-01-21
| | | | | | | | | | | | | | | This new version is much more aggressive about doing "full" reduction in cases where it reduces register pressure, and also more aggressive about rewriting induction variables to count down (or up) to zero when doing so reduces register pressure. It currently uses fairly simplistic algorithms for finding reuse opportunities, but it introduces a new framework allows it to combine multiple strategies at once to form hybrid solutions, instead of doing all full-reduction or all base+index. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94061 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo and an 80-column violation in comments.Dan Gohman2010-01-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93931 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a comment typo.Bob Wilson2009-12-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90511 91177308-0d34-0410-b5e6-96231b3b80d8