diff options
author | Andrew Trick <atrick@apple.com> | 2013-03-19 04:14:59 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2013-03-19 04:14:59 +0000 |
commit | 82cd8f7382322bee7a71cdc31f7a923c44d37d32 (patch) | |
tree | f28e5aecf7955206a377bc8eedd87c3a413a0b9b | |
parent | 4b02729558b5bca2208fa9649964676e7d018c4f (diff) |
Cleanup some SCEV logic a bit.
Make the code more obvious to scan-build and humans.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177375 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index e4f093e1c3..f01af001ca 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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"); |