summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AVR
diff options
context:
space:
mode:
authorDylan McKay <me@dylanmckay.io>2017-09-26 00:51:03 +0000
committerDylan McKay <me@dylanmckay.io>2017-09-26 00:51:03 +0000
commitdada014781e8277ddc829e47aa337ab9792d8485 (patch)
treefdad99091dc10157431f7d16555f6b5cd8779765 /llvm/lib/Target/AVR
parent832c4a65c0b22f9e88374703db1064f8a7d7a7d4 (diff)
downloadbcm5719-llvm-dada014781e8277ddc829e47aa337ab9792d8485.tar.gz
bcm5719-llvm-dada014781e8277ddc829e47aa337ab9792d8485.zip
[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: 314180
Diffstat (limited to 'llvm/lib/Target/AVR')
-rw-r--r--llvm/lib/Target/AVR/AVRISelLowering.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/AVR/AVRISelLowering.cpp b/llvm/lib/Target/AVR/AVRISelLowering.cpp
index ab49cf9de89..50255f3ae67 100644
--- a/llvm/lib/Target/AVR/AVRISelLowering.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud