[llvm] r314180 - [AVR] When lowering shifts into loops, put newly generated MBBs in the same
Dylan McKay via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 25 17:51:03 PDT 2017
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;
// Create loop block.
MachineBasicBlock *LoopBB = F->CreateMachineBasicBlock(LLVM_BB);
More information about the llvm-commits
mailing list