diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2009-05-09 01:08:24 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2009-05-09 01:08:24 +0000 |
| commit | b9dcc2c0c933c528fdbc71a5de4a42bb772cd6f9 (patch) | |
| tree | 5da033087dfafba2e2f1ed9a9cb3a9f21ec60290 /llvm/lib/Transforms | |
| parent | 8038f7b30fa2dd40cba273196cd6e57ee4c6d921 (diff) | |
| download | bcm5719-llvm-b9dcc2c0c933c528fdbc71a5de4a42bb772cd6f9.tar.gz bcm5719-llvm-b9dcc2c0c933c528fdbc71a5de4a42bb772cd6f9.zip | |
Factor out code that optimize loop terminating condition.
llvm-svn: 71305
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index f441968d92d..8d3240e0620 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -164,8 +164,11 @@ namespace { ICmpInst *ChangeCompareStride(Loop *L, ICmpInst *Cond, IVStrideUse* &CondUse, const SCEVHandle* &CondStride); + void OptimizeIndvars(Loop *L); + void OptimizeLoopTermCond(Loop *L); + /// OptimizeShadowIV - If IV is used in a int-to-float cast /// inside the loop then try to eliminate the cast opeation. void OptimizeShadowIV(Loop *L); @@ -2378,6 +2381,12 @@ void LoopStrengthReduce::OptimizeIndvars(Loop *L) { OptimizeShadowIV(L); + OptimizeLoopTermCond(L); +} + +/// OptimizeLoopTermCond - Change loop terminating condition to use the +/// postinc iv when possible. +void LoopStrengthReduce::OptimizeLoopTermCond(Loop *L) { // Finally, get the terminating condition for the loop if possible. If we // can, we want to change it to use a post-incremented version of its // induction variable, to allow coalescing the live ranges for the IV into |

