[llvm] r189911 - Use llvm::next() instead of incrementing begin iterators of std::vector.

Michael Gottesman mgottesman at apple.com
Tue Sep 3 21:19:02 PDT 2013


Author: mgottesman
Date: Tue Sep  3 23:19:01 2013
New Revision: 189911

URL: http://llvm.org/viewvc/llvm-project?rev=189911&view=rev
Log:
Use llvm::next() instead of incrementing begin iterators of std::vector.

Iterator of std::vector may be implemented as a raw pointer. In
this case begin iterators are rvalues and cannot be incremented.
For example, this is the case with STDCXX implementation of vector.

Patch by Konstantin Tokarev <annulen at yandex.ru>.

Modified:
    llvm/trunk/lib/Target/R600/AMDILCFGStructurizer.cpp

Modified: llvm/trunk/lib/Target/R600/AMDILCFGStructurizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDILCFGStructurizer.cpp?rev=189911&r1=189910&r2=189911&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDILCFGStructurizer.cpp (original)
+++ llvm/trunk/lib/Target/R600/AMDILCFGStructurizer.cpp Tue Sep  3 23:19:01 2013
@@ -1233,7 +1233,7 @@ int AMDGPUCFGStructurizer::handleJumpint
 
       numClonedBlock += Num;
       Num += serialPatternMatch(*HeadMBB->succ_begin());
-      Num += serialPatternMatch(*(++HeadMBB->succ_begin()));
+      Num += serialPatternMatch(*next(HeadMBB->succ_begin()));
       Num += ifPatternMatch(HeadMBB);
       assert(Num > 0);
 
@@ -1713,7 +1713,7 @@ void AMDGPUCFGStructurizer::removeRedund
   if (MBB->succ_size() != 2)
     return;
   MachineBasicBlock *MBB1 = *MBB->succ_begin();
-  MachineBasicBlock *MBB2 = *(++MBB->succ_begin());
+  MachineBasicBlock *MBB2 = *next(MBB->succ_begin());
   if (MBB1 != MBB2)
     return;
 





More information about the llvm-commits mailing list