Skip to content

Commit c7d5217

Browse files
committed
[AVR] When lowering Select8/Select16, put newly generated MBBs in the same
spot as the original MBB (avr-rust/rust-legacy-fork#49)
1 parent 07a96e3 commit c7d5217

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/Target/AVR/AVRISelLowering.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1612,8 +1612,9 @@ AVRTargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
16121612
MachineBasicBlock *trueMBB = MF->CreateMachineBasicBlock(LLVM_BB);
16131613
MachineBasicBlock *falseMBB = MF->CreateMachineBasicBlock(LLVM_BB);
16141614

1615-
MachineFunction::iterator I = MBB->getParent()->begin();
1616-
++I;
1615+
MachineFunction::iterator I;
1616+
for (I = MF->begin(); I != MF->end() && &(*I) != MBB; ++I);
1617+
if (I != MF->end()) ++I;
16171618
MF->insert(I, trueMBB);
16181619
MF->insert(I, falseMBB);
16191620

0 commit comments

Comments
 (0)