summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan McKay <me@dylanmckay.io>2017-09-28 07:18:32 +0000
committerDylan McKay <me@dylanmckay.io>2017-09-28 07:18:32 +0000
commitfe7556b49ac5f8fbea10b00e35ebe0500773075c (patch)
tree11558e94b051b1d77f9a0bd0c47271c4d01a8a49
parent93c290035c36b2c9fdd4cfeb77455955ad8b5774 (diff)
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. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314383 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/AVR/AVRISelLowering.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Target/AVR/AVRISelLowering.cpp b/lib/Target/AVR/AVRISelLowering.cpp
index 7d3faac1dcc2..d8e8bc1ff554 100644
--- a/lib/Target/AVR/AVRISelLowering.cpp
+++ b/lib/Target/AVR/AVRISelLowering.cpp
@@ -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);