diff options
| author | Dan Gohman <gohman@apple.com> | 2009-12-18 01:24:09 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-12-18 01:24:09 +0000 |
| commit | 18fa5686f6e06c60bcbfd20a6418c2e5bee8c856 (patch) | |
| tree | aece8390eca40bd85f9bbcfdf08589109e6271dc /llvm/lib/Analysis/IVUsers.cpp | |
| parent | fd7231f1fe2ceed126bee6593f940563158c690f (diff) | |
| download | bcm5719-llvm-18fa5686f6e06c60bcbfd20a6418c2e5bee8c856.tar.gz bcm5719-llvm-18fa5686f6e06c60bcbfd20a6418c2e5bee8c856.zip | |
Add Loop contains utility methods for testing whether a loop
contains another loop, or an instruction. The loop form is
substantially more efficient on large loops than the typical
code it replaces.
llvm-svn: 91654
Diffstat (limited to 'llvm/lib/Analysis/IVUsers.cpp')
| -rw-r--r-- | llvm/lib/Analysis/IVUsers.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/IVUsers.cpp b/llvm/lib/Analysis/IVUsers.cpp index c697df93688..1e5177128cc 100644 --- a/llvm/lib/Analysis/IVUsers.cpp +++ b/llvm/lib/Analysis/IVUsers.cpp @@ -53,7 +53,7 @@ static bool containsAddRecFromDifferentLoop(const SCEV *S, Loop *L) { if (newLoop == L) return false; // if newLoop is an outer loop of L, this is OK. - if (newLoop->contains(L->getHeader())) + if (newLoop->contains(L)) return false; } return true; @@ -148,7 +148,7 @@ static bool IVUseShouldUsePostIncValue(Instruction *User, Instruction *IV, Loop *L, LoopInfo *LI, DominatorTree *DT, Pass *P) { // If the user is in the loop, use the preinc value. - if (L->contains(User->getParent())) return false; + if (L->contains(User)) return false; BasicBlock *LatchBlock = L->getLoopLatch(); if (!LatchBlock) @@ -209,7 +209,7 @@ bool IVUsers::AddUsersIfInteresting(Instruction *I) { return false; // Non-reducible symbolic expression, bail out. // Keep things simple. Don't touch loop-variant strides. - if (!Stride->isLoopInvariant(L) && L->contains(I->getParent())) + if (!Stride->isLoopInvariant(L) && L->contains(I)) return false; SmallPtrSet<Instruction *, 4> UniqueUsers; @@ -324,7 +324,7 @@ const SCEV *IVUsers::getReplacementExpr(const IVStrideUse &U) const { if (U.isUseOfPostIncrementedValue()) RetVal = SE->getAddExpr(RetVal, U.getParent()->Stride); // Evaluate the expression out of the loop, if possible. - if (!L->contains(U.getUser()->getParent())) { + if (!L->contains(U.getUser())) { const SCEV *ExitVal = SE->getSCEVAtScope(RetVal, L->getParentLoop()); if (ExitVal->isLoopInvariant(L)) RetVal = ExitVal; |

