[llvm] r205005 - R600: avoid calling std::next on an iterator that might be end()

Tom Stellard tom at stellard.net
Fri Mar 28 07:05:25 PDT 2014


On Fri, Mar 28, 2014 at 01:52:57PM -0000, Tim Northover wrote:
> Author: tnorthover
> Date: Fri Mar 28 08:52:56 2014
> New Revision: 205005
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=205005&view=rev
> Log:
> 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).
> 

Thanks for fixing this.

-Tom

> Modified:
>     llvm/trunk/lib/Target/R600/SILowerControlFlow.cpp
> 
> Modified: llvm/trunk/lib/Target/R600/SILowerControlFlow.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SILowerControlFlow.cpp?rev=205005&r1=205004&r2=205005&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/R600/SILowerControlFlow.cpp (original)
> +++ llvm/trunk/lib/Target/R600/SILowerControlFlow.cpp Fri Mar 28 08:52:56 2014
> @@ -439,10 +439,10 @@ bool SILowerControlFlowPass::runOnMachin
>         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;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list