diff options
| author | Dan Gohman <gohman@apple.com> | 2009-03-09 20:46:50 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-03-09 20:46:50 +0000 |
| commit | e201f8ff1d1a210b495474ff6584c099137ed50b (patch) | |
| tree | c6fb42ce65c3ebdc689e5f215deb79e90632105b /llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
| parent | de2f33373b6e217452df1aa0b1363b6d79a0c567 (diff) | |
| download | bcm5719-llvm-e201f8ff1d1a210b495474ff6584c099137ed50b.tar.gz bcm5719-llvm-e201f8ff1d1a210b495474ff6584c099137ed50b.zip | |
Move the sorting of the StrideOrder array earlier so that it doesn't
have to be done twice.
llvm-svn: 66449
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index c89a4968c0b..bab778832f0 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2147,7 +2147,6 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond, Value *NewCmpRHS = NULL; int64_t Scale = 1; SCEVHandle NewOffset = SE->getIntegerSCEV(0, UIntPtrTy); - std::stable_sort(StrideOrder.begin(), StrideOrder.end(), StrideCompare()); if (ConstantInt *C = dyn_cast<ConstantInt>(Cond->getOperand(1))) { int64_t CmpVal = C->getValue().getSExtValue(); @@ -2611,6 +2610,9 @@ bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) { DEBUG(L->dump()); #endif + // Sort the StrideOrder so we process larger strides first. + std::stable_sort(StrideOrder.begin(), StrideOrder.end(), StrideCompare()); + // Optimize induction variables. Some indvar uses can be transformed to use // strides that will be needed for other purposes. A common example of this // is the exit test for the loop, which can often be rewritten to use the @@ -2629,9 +2631,6 @@ bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) { // IVsByStride keeps IVs for one particular loop. assert(IVsByStride.empty() && "Stale entries in IVsByStride?"); - // Sort the StrideOrder so we process larger strides first. - std::stable_sort(StrideOrder.begin(), StrideOrder.end(), StrideCompare()); - // Note: this processes each stride/type pair individually. All users // passed into StrengthReduceStridedIVUsers have the same type AND stride. // Also, note that we iterate over IVUsesByStride indirectly by using |

