BBVectorize: Simplify code, no functionality change.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 2 Feb 2012 18:52:15 +0000 (18:52 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 2 Feb 2012 18:52:15 +0000 (18:52 +0000)
Also silences warnings about bodyless for loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149612 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/BBVectorize.cpp

index dc88e2c85f61aad0d5362785ac06cfee15c2260a..ce6e994c463d70422b523c00a2ebf3d4968b93c0 100644 (file)
@@ -1591,9 +1591,7 @@ namespace {
                      std::multimap<Value *, Value *> &LoadMoveSet,
                      Instruction *I, Instruction *J) {
     // Skip to the first instruction past I.
-    BasicBlock::iterator L = BB.begin();
-    for (; cast<Instruction>(L) != I; ++L);
-    ++L;
+    BasicBlock::iterator L = llvm::next(BasicBlock::iterator(I));
 
     DenseSet<Value *> Users;
     AliasSetTracker WriteSet(*AA);
@@ -1613,9 +1611,7 @@ namespace {
                      Instruction *&InsertionPt,
                      Instruction *I, Instruction *J) {
     // Skip to the first instruction past I.
-    BasicBlock::iterator L = BB.begin();
-    for (; cast<Instruction>(L) != I; ++L);
-    ++L;
+    BasicBlock::iterator L = llvm::next(BasicBlock::iterator(I));
 
     DenseSet<Value *> Users;
     AliasSetTracker WriteSet(*AA);
@@ -1643,9 +1639,7 @@ namespace {
                      std::multimap<Value *, Value *> &LoadMoveSet,
                      Instruction *I) {
     // Skip to the first instruction past I.
-    BasicBlock::iterator L = BB.begin();
-    for (; cast<Instruction>(L) != I; ++L);
-    ++L;
+    BasicBlock::iterator L = llvm::next(BasicBlock::iterator(I));
 
     DenseSet<Value *> Users;
     AliasSetTracker WriteSet(*AA);