From bd2cca79b753e9491765a5b930ecd38e7fe76d72 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Fri, 28 Mar 2014 13:52:56 +0000 Subject: R600: avoid calling std::next on an iterator that might be end() This was causing my llc to go into an infinite loop on CodeGen/R600/address-space.ll (just triggered recently by some allocator changes). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205005 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SILowerControlFlow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Target/R600/SILowerControlFlow.cpp b/lib/Target/R600/SILowerControlFlow.cpp index 182f28ba77..c2f8696473 100644 --- a/lib/Target/R600/SILowerControlFlow.cpp +++ b/lib/Target/R600/SILowerControlFlow.cpp @@ -439,10 +439,10 @@ bool SILowerControlFlowPass::runOnMachineFunction(MachineFunction &MF) { BI != BE; ++BI) { MachineBasicBlock &MBB = *BI; - for (MachineBasicBlock::iterator I = MBB.begin(), Next = std::next(I); - I != MBB.end(); I = Next) { - + MachineBasicBlock::iterator I, Next; + for (I = MBB.begin(); I != MBB.end(); I = Next) { Next = std::next(I); + MachineInstr &MI = *I; if (TII->isDS(MI.getOpcode())) { NeedM0 = true; -- cgit v1.2.3