[llvm] r177375 - Cleanup some SCEV logic a bit.

Andrew Trick atrick at apple.com
Mon Mar 18 21:14:59 PDT 2013


Author: atrick
Date: Mon Mar 18 23:14:59 2013
New Revision: 177375

URL: http://llvm.org/viewvc/llvm-project?rev=177375&view=rev
Log:
Cleanup some SCEV logic a bit.

Make the code more obvious to scan-build and humans.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=177375&r1=177374&r2=177375&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Mar 18 23:14:59 2013
@@ -2718,8 +2718,9 @@ void LSRInstance::GenerateIVChain(const
   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
       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");





More information about the llvm-commits mailing list