[llvm] r314180 - [AVR] When lowering shifts into loops, put newly generated MBBs in the same

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 18:01:02 PDT 2017


On 9/25/2017 5:51 PM, Dylan McKay via llvm-commits wrote:
> Author: dylanmckay
> Date: Mon Sep 25 17:51:03 2017
> New Revision: 314180
>
> URL: http://llvm.org/viewvc/llvm-project?rev=314180&view=rev
> Log:
> [AVR] When lowering shifts into loops, put newly generated MBBs in the same
> spot as the original MBB
>
> Discovered in avr-rust/rust#62
> https://github.com/avr-rust/rust/issues/62
>
> Patch by Gergo Erdi.
>
> Modified:
>      llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp
>
> Modified: llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp?rev=314180&r1=314179&r2=314180&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp Mon Sep 25 17:51:03 2017
> @@ -1469,8 +1469,10 @@ MachineBasicBlock *AVRTargetLowering::in
>     }
>   
>     const BasicBlock *LLVM_BB = BB->getBasicBlock();
> -  MachineFunction::iterator I = BB->getParent()->begin();
> -  ++I;
> +
> +  MachineFunction::iterator I;
> +  for (I = F->begin(); I != F->end() && &(*I) != BB; ++I);
> +  if (I != F->end()) ++I;
>   

You can convert a MachineBasicBlock* to a MachineFunction::iterator by 
calling "BB->getIterator()".

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-commits mailing list