Don't evaluate rend() on every iteration of the loop.
authorChad Rosier <mcrosier@codeaurora.org>
Tue, 10 Mar 2015 20:29:59 +0000 (20:29 +0000)
committerChad Rosier <mcrosier@codeaurora.org>
Tue, 10 Mar 2015 20:29:59 +0000 (20:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231837 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/BranchFolding.cpp

index 05bf31b3ba00d1810d4ea5233009ce705ea3fcef..a2e981680c68191b6b467d7e48eca821e8067a5d 100644 (file)
@@ -755,11 +755,13 @@ removeMMOsFromMemoryOperations(MachineBasicBlock::iterator MBBIStartPos,
     ++CommonTailLen;
 
   MachineBasicBlock::reverse_iterator MBBI = MBB->rbegin();
+  MachineBasicBlock::reverse_iterator MBBIE = MBB->rend();
   MachineBasicBlock::reverse_iterator MBBICommon = MBBCommon.rbegin();
   MachineBasicBlock::reverse_iterator MBBIECommon = MBBCommon.rend();
 
   while (CommonTailLen--) {
-    assert(MBBI != MBB->rend() && "Reached BB end within common tail length!");
+    assert(MBBI != MBBIE && "Reached BB end within common tail length!");
+    (void)MBBIE;
 
     if (MBBI->isDebugValue()) {
       ++MBBI;