diff options
| author | Dan Gohman <gohman@apple.com> | 2010-08-13 20:11:39 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-08-13 20:11:39 +0000 |
| commit | e0d71c1ea32ff0e88b1334ddaec458cb335ce887 (patch) | |
| tree | 20cd0db7d8abc98504ad241e1a6f679b36660e91 /lib | |
| parent | 6514e1aae564fa5c366cf0837baf5c03f7d04a12 (diff) | |
| download | external_llvm-e0d71c1ea32ff0e88b1334ddaec458cb335ce887.zip external_llvm-e0d71c1ea32ff0e88b1334ddaec458cb335ce887.tar.gz external_llvm-e0d71c1ea32ff0e88b1334ddaec458cb335ce887.tar.bz2 | |
An add recurrence is loop-invariant in any loop inside of its
associated loop. This avoids potentially expensive traversals
of the add recurrence's operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111034 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 394e015..dee7a1f 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -303,6 +303,10 @@ bool SCEVAddRecExpr::isLoopInvariant(const Loop *QueryLoop) const { if (QueryLoop->contains(L)) return false; + // This recurrence is invariant w.r.t. QueryLoop if L contains QueryLoop. + if (L->contains(QueryLoop)) + return true; + // This recurrence is variant w.r.t. QueryLoop if any of its operands // are variant. for (unsigned i = 0, e = getNumOperands(); i != e; ++i) |
