diff options
| author | Dylan McKay <me@dylanmckay.io> | 2017-05-13 00:22:34 +0000 |
|---|---|---|
| committer | Dylan McKay <me@dylanmckay.io> | 2017-05-13 00:22:34 +0000 |
| commit | 0c4debc123b3cf92d018700a26a32ae5fc39a7b9 (patch) | |
| tree | 82faff5a37a789f601dc4da58f611233ade6e463 /llvm/lib | |
| parent | b7132663315aa218a256cfc968d94277e6a6fdbb (diff) | |
| download | bcm5719-llvm-0c4debc123b3cf92d018700a26a32ae5fc39a7b9.tar.gz bcm5719-llvm-0c4debc123b3cf92d018700a26a32ae5fc39a7b9.zip | |
[AVR] When lowering Select8/Select16, put newly generated MBBs in the same spot
Contributed by Dr. Gergő Érdi.
Fixes a bug.
Raised from (https://github.com/avr-rust/rust/issues/49).
llvm-svn: 302973
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/AVR/AVRISelLowering.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/AVR/AVRISelLowering.cpp b/llvm/lib/Target/AVR/AVRISelLowering.cpp index 0d8c44e8761..ef9c00e4b78 100644 --- a/llvm/lib/Target/AVR/AVRISelLowering.cpp +++ b/llvm/lib/Target/AVR/AVRISelLowering.cpp @@ -1610,8 +1610,9 @@ AVRTargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *trueMBB = MF->CreateMachineBasicBlock(LLVM_BB); MachineBasicBlock *falseMBB = MF->CreateMachineBasicBlock(LLVM_BB); - MachineFunction::iterator I = MBB->getParent()->begin(); - ++I; + MachineFunction::iterator I; + for (I = MF->begin(); I != MF->end() && &(*I) != MBB; ++I); + if (I != MF->end()) ++I; MF->insert(I, trueMBB); MF->insert(I, falseMBB); |

