summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-03-19 04:14:59 +0000
committerAndrew Trick <atrick@apple.com>2013-03-19 04:14:59 +0000
commitde78866594d7f38cdf4418552b4034cc81d4a803 (patch)
treec9b0e548309ebef0b3a0d63c9a1d7c13cdadc4e6
parenta1c01ba8c77d83fae19ce63c84d4293a5d08d348 (diff)
downloadbcm5719-llvm-de78866594d7f38cdf4418552b4034cc81d4a803.tar.gz
bcm5719-llvm-de78866594d7f38cdf4418552b4034cc81d4a803.zip
Cleanup some SCEV logic a bit.
Make the code more obvious to scan-build and humans. llvm-svn: 177375
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index e4f093e1c37..f01af001ca9 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2718,8 +2718,9 @@ void LSRInstance::GenerateIVChain(const IVChain &Chain, SCEVExpander &Rewriter,
User::op_iterator IVOpEnd = Head.UserInst->op_end();
User::op_iterator IVOpIter = findIVOperand(Head.UserInst->op_begin(),
IVOpEnd, L, SE);
+ assert(IVOpIter != IVOpEnd && "No IV operands found");
Value *IVSrc = 0;
- while (IVOpIter != IVOpEnd) {
+ do {
IVSrc = getWideOperand(*IVOpIter);
// If this operand computes the expression that the chain needs, we may use
@@ -2735,7 +2736,8 @@ void LSRInstance::GenerateIVChain(const IVChain &Chain, SCEVExpander &Rewriter,
break;
}
IVOpIter = findIVOperand(llvm::next(IVOpIter), IVOpEnd, L, SE);
- }
+ } while (IVOpIter != IVOpEnd);
+
if (IVOpIter == IVOpEnd) {
// Gracefully give up on this chain.
DEBUG(dbgs() << "Concealed chain head: " << *Head.UserInst << "\n");
OpenPOWER on IntegriCloud