From dad3b0ec717a54b58e818fa5b5c4e1811c0f97bc Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Tue, 10 Mar 2015 20:29:59 +0000 Subject: [PATCH] Don't evaluate rend() on every iteration of the loop. llvm-svn: 231837 --- lib/CodeGen/BranchFolding.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp index 05bf31b3ba0..a2e981680c6 100644 --- a/lib/CodeGen/BranchFolding.cpp +++ b/lib/CodeGen/BranchFolding.cpp @@ -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;