<p>I tried to insert a new MachineBasicBlock at the beginning of functions, but when I do that like
<pre>
  MachineBasicBlock *entry = MF.begin();
  const BasicBlock *block = entry->getBasicBlock();

  MachineBasicBlock *newMBB = MF.CreateMachineBasicBlock(block);                        
  MachineInstrBuilder instr = BuildMI(labelBlock, TII->get(X86::NOOP));
  newMBB->addSuccessor(entry);
  MF.push_front(newMBB);
</pre>
</p>

<p>
llc fails with the following error message. Can someone tell me what I am doing wrong?
<pre>
  llc: MachineRegisterInfo.cpp:33: llvm::MachineRegisterInfo::~MachineRegisterInfo():
  Assertion `!PhysRegUseDefLists[i] && "PhysRegUseDefLists has entries after all instructions are deleted"' failed.
</pre>
</p>

<p>
Apart from that llc fails when I run my modified version on larger test programs. The error message displayed is:
<pre>
  lc: MachineBasicBlock.cpp:361:
  bool llvm::MachineBasicBlock::CorrectExtraCFGEdges(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*, bool):
  Assertion `DestA == 0 && "MachineCFG is missing edges!"' failed.
</pre>
</p>
I did not overwrite getAnalysisUsage, therefore not guaranteeing to preserve anything. Clearly, the runtime check adds edges to the CFG. What may be the cause of this error and how can I fix it?

-Artjom
<br><hr align="left" width="300">
View this message in context: <a href="http://www.nabble.com/code-altering-Passes-for-llc-tp24778261p24988862.html">Re: code-altering Passes for llc</a><br>
Sent from the <a href="http://www.nabble.com/LLVM---Dev-f692.html">LLVM - Dev mailing list archive</a> at Nabble.com.<br>