Commit c2f252c4 authored by Dylan McKay's avatar Dylan McKay
Browse files

Merging r314180:

------------------------------------------------------------------------
r314180 | dylanmckay | 2017-09-26 13:51:03 +1300 (Tue, 26 Sep 2017) | 7 lines

[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.
------------------------------------------------------------------------

llvm-svn: 314383
parent 6058b5f9
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1469,8 +1469,10 @@ MachineBasicBlock *AVRTargetLowering::insertShift(MachineInstr &MI,
  }

  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;

  // Create loop block.
  MachineBasicBlock *LoopBB = F->CreateMachineBasicBlock(LLVM_BB);