diff options
| author | Dan Gohman <gohman@apple.com> | 2010-04-08 05:57:57 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-04-08 05:57:57 +0000 |
| commit | 279bdd796e450512f21ddbaa647ba1b75f5981bc (patch) | |
| tree | 42e8019595b982abefb76583f62dfa37bda9cbab /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
| parent | 3a10bb0e4f485ff295665f37128a92fa8a5077f3 (diff) | |
| download | external_llvm-279bdd796e450512f21ddbaa647ba1b75f5981bc.zip external_llvm-279bdd796e450512f21ddbaa647ba1b75f5981bc.tar.gz external_llvm-279bdd796e450512f21ddbaa647ba1b75f5981bc.tar.bz2 | |
When expanding expressions which are using post-inc mode for multiple loops,
ensure that the expansion is dominated by the increments of those loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100748 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
| -rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 631092b..6eaa93d 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2820,6 +2820,22 @@ Value *LSRInstance::Expand(const LSRFixup &LF, else Inputs.push_back(IVIncInsertPos); } + // The expansion must also be dominated by the increment positions of any + // loops it for which it is using post-inc mode. + for (PostIncLoopSet::const_iterator I = LF.PostIncLoops.begin(), + E = LF.PostIncLoops.end(); I != E; ++I) { + const Loop *PIL = *I; + if (PIL == L) continue; + + SmallVector<BasicBlock *, 4> ExitingBlocks; + PIL->getExitingBlocks(ExitingBlocks); + if (!ExitingBlocks.empty()) { + BasicBlock *BB = ExitingBlocks[0]; + for (unsigned i = 1, e = ExitingBlocks.size(); i != e; ++i) + BB = DT.findNearestCommonDominator(BB, ExitingBlocks[i]); + Inputs.push_back(BB->getTerminator()); + } + } // Then, climb up the immediate dominator tree as far as we can go while // still being dominated by the input positions. |
