Fix PR4926. When target hook EmitInstrWithCustomInserter() insert new basic blocks...
[oota-llvm.git] / lib / Target / Alpha / AlphaISelLowering.cpp
index 1034b6103e94dfdcc1355b052b29e5b30c6d7943..777ab524adafe4e9c388c17dc3a56cc33058fcb5 100644 (file)
@@ -855,6 +855,11 @@ AlphaTargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
   MachineBasicBlock *llscMBB = F->CreateMachineBasicBlock(LLVM_BB);
   MachineBasicBlock *sinkMBB = F->CreateMachineBasicBlock(LLVM_BB);
 
+  // Inform sdisel of the edge changes.
+  for (MachineBasicBlock::succ_iterator I = BB->succ_begin(), 
+         E = BB->succ_end(); I != E; ++I)
+    EM->insert(std::make_pair(*I, sinkMBB));
+
   sinkMBB->transferSuccessors(thisMBB);
 
   F->insert(It, llscMBB);